How do I bind data or info from a database table to the labels inside a datalist, listview or gridview ITEMTEMPLATE?
I have a table Product_table(Pro_id,pro_imagepath).
I want to have a datalist or listview in which the itemtemplate contains an image control and a label. I would like to bind the pro_imagepath to the image control inside the itemtemplate, and the pro_id to the label inside the itemtemplate.
if your list view has already been databound you should just be able to use
<%#Eval("pro_imagepath")%>and<%#Eval("Pro_id")%>respectively.To use those inside of a control you will need to do something like this.
Be sure that the properties of the control you want to bind are using single quotes instead of double quotes when putting an EVAL() in them.