Repeater Control Problem
-
Using the Repeater control to load text and images. The filenames for the images are stored as text in the database. I would like to have the JPG files located in another folder....but can't seem to get the syntax correct. ...DataBinder.Eval(Container.DataItem, "name", "location of folder" .... no matter what I put in the location of folder area it doesn't work. such as....
But if I move the JPG Image1 into the same directory with my code, then this works.
Any help would be appreciated.
-
Using the Repeater control to load text and images. The filenames for the images are stored as text in the database. I would like to have the JPG files located in another folder....but can't seem to get the syntax correct. ...DataBinder.Eval(Container.DataItem, "name", "location of folder" .... no matter what I put in the location of folder area it doesn't work. such as....
But if I move the JPG Image1 into the same directory with my code, then this works.
Any help would be appreciated.
tjmule22 wrote: DataBinder.Eval(Container.DataItem, "Image1", "/images/") You should show it with one or two dots: ./images/imagename.jpg ../images/imagesname.jpg Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
-
tjmule22 wrote: DataBinder.Eval(Container.DataItem, "Image1", "/images/") You should show it with one or two dots: ./images/imagename.jpg ../images/imagesname.jpg Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
Thanks....that seemed to solve part of my problem. ../images/imagesname.jpg ...this works as long as I type in the name of the file, however the name of the file is actually stored in a database field. That's why my code looks like this, but for some reason I'm not getting the correct name... This works...with the image name being MYImage  %>) but this does not...with MYImage stored in a field name MainPic.  %>) -
Using the Repeater control to load text and images. The filenames for the images are stored as text in the database. I would like to have the JPG files located in another folder....but can't seem to get the syntax correct. ...DataBinder.Eval(Container.DataItem, "name", "location of folder" .... no matter what I put in the location of folder area it doesn't work. such as....
But if I move the JPG Image1 into the same directory with my code, then this works.
Any help would be appreciated.
This assumes that your images are in a folder named "images" which is in the root of the web site and that the field "Image1" in the database contains only the image file name. If this is the case you just need to concatonate the path to the images to the filename, as is done above. The third parameter of the DataBinder.Eval function is for formatting the data (i.e. "{0:c}" is used to format a number to currency). There might be a way to do what you want through this parameter but contatonating the path will get the job done.
Wally Atkins
Newport News, VA, USA
http://wallyatkins.com -
This assumes that your images are in a folder named "images" which is in the root of the web site and that the field "Image1" in the database contains only the image file name. If this is the case you just need to concatonate the path to the images to the filename, as is done above. The third parameter of the DataBinder.Eval function is for formatting the data (i.e. "{0:c}" is used to format a number to currency). There might be a way to do what you want through this parameter but contatonating the path will get the job done.
Wally Atkins
Newport News, VA, USA
http://wallyatkins.com