binding images in repeater
-
im storing image filename in db uploaded through upload control and images in a physical path.. i need to bind the images in repeater control using filename from db and physical path.. how to do it please help me..
Use the itemTemplate of repeater control. Add following in the ItemTemplate of repeater.
 %> "<%# Eval("ImageTitle") %>")
Or same thing can be done at the ItemDataBound event of the repeater control, you can dynamically create the image after getting the imagename from the data item.
Regards, Prakash Kalakoti
-
Use the itemTemplate of repeater control. Add following in the ItemTemplate of repeater.
 %> "<%# Eval("ImageTitle") %>")
Or same thing can be done at the ItemDataBound event of the repeater control, you can dynamically create the image after getting the imagename from the data item.
Regards, Prakash Kalakoti
-
thanks.. the physical path im saving is
img.ImageUrl = "~/test/" + pid + "_" + img1;
//img1 is filename in db.
//pid is projectidwhere pid is from session.. How do i get this...
-
Can you confirm that test folder is located in the root of the website and all you image names are in the format pid_imagename?
Regards, Prakash Kalakoti
-
In that case it should show the image. Do one thing, go to the rendered web page right click on the image icon and click on the property option and check the address of the image, you will come to know what is the issue with the path/filename [might be the value from session not getting appended properly].
Regards, Prakash Kalakoti
-
In that case it should show the image. Do one thing, go to the rendered web page right click on the image icon and click on the property option and check the address of the image, you will come to know what is the issue with the path/filename [might be the value from session not getting appended properly].
Regards, Prakash Kalakoti
-
im storing image filename in db uploaded through upload control and images in a physical path.. i need to bind the images in repeater control using filename from db and physical path.. how to do it please help me..
if you want to bind/associate image details on data bound event, you need to do following, step 1. Identify the layout controls inside the repeater. Say if you have a Table layout which is repeating for each row of data source. You need to capture that in that data bound event handler. (To do that you might need to add a runat = server in case of a table layout ) step 2. Once the layout control is identified, find the image control ( assuming that in aspx file you must have provided an image control inside layout to display the images). Then set required property of that images. NB: Row Bound event handler's event argument should give you the data from database i.e image title, image path etc. Please let me know if you need more help.
Thanks, Arindam D Tewary