Home All Groups Group Topic Archive Search About
Author
16 Jun 2005 12:07 PM
huseyin_akturk
Hi,
I am using a template column. There is an image in that template column. But if I change the url of the image, image does not shown. I debugged program and I see that there is no wrong in path. I mean that my image is in true folder.
Code: --------------------  
  string new_url= "file:///F:\\Inetpub\\wwwroot\\PROJECT\\arrows\\arrow1.jpg";
  System.Web.UI.WebControls.Image image= (System.Web.UI.WebControls.Image)datagrid1.Items[i].FindControl("Image1"); // i = index..
  image.ImageUrl = new_url;
  --------------------

This the code that I am changing image url. Is there any thing that I should write?
Thanks. -- huseyin_akturk ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------

Author
16 Jun 2005 3:01 PM
Brock Allen
The URL you specify in the image isn't the path from the server's perspective.
The URL should be form the client's perspective. So it'll be a path the browser
can use to find the image. It'll look like "http://yourserver/yourapp/directory/arrow1.jpg".
The reason it was working before is probabaly because you were running your
browser on the same machine as the server, so the "file://" URI was accessible
form the browser.

-Brock
DevelopMentor
http://staff.develop.com/ballen



Show quoteHide quote
> Hi,
> I am using a template column. There is an image in that template
> column. But if I change the url of the image, image does not shown. I
> debugged program and I see that there is no wrong in path. I mean that
> my image is in true folder.
> Code:
> --------------------
> string new_url=
> "file:///F:\\Inetpub\\wwwroot\\PROJECT\\arrows\\arrow1.jpg";
> System.Web.UI.WebControls.Image image=
> (System.Web.UI.WebControls.Image)datagrid1.Items[i].FindControl("Image
> 1"); // i = index..
> image.ImageUrl = new_url;
> --------------------
>
> This the code that I am changing image url. Is there any thing that I
> should write?
> Thanks.
> --
> huseyin_akturk
> ----------------------------------------------------------------------
> --
> Posted via http://www.codecomments.com
> ----------------------------------------------------------------------
> --