My list view ItemTemplate is as follows
<a href='<%# getpath(Eval("IMAGE_PATH")) %>' title='<%# Eval("IMAGE_DESCRIPTION") %>'>
<asp:Image ID="capty" CssClass="capty" runat="server"
AlternateText='<%# Eval("IMAGE_DESCRIPTION") %>'
ImageUrl='<%# retriveurl(Eval("IMAGE_PATH")) %>'
Height="100px" Width="150px">
</asp:Image>
</a>
my codebehind source is
int count=ListView1.Items.Count;
List<ImageGallery> _list = new List<ImageGallery>();
for (int i = 0; i < count; i++)
{
ImageGallery ob = new ImageGallery();
ob.ImageName = ??
ob.Description = ??
_list.Add(ob);
}
now i want to insert the Eval(“IMAGE_DESCRIPTION”) data to a ob.Description and ob.ImageName=Eval(“IMAGE_ID”) .How to do this?
List<ImageGallery> _list = new List<ImageGallery>();
for (int i = 0; i < ListView1.Items.Count; i++)
{
ImageGallery ob = new ImageGallery();
ob.ImageName = "";
ob.Description = " ";
_list.Add(ob);
}
You can use
FindControlto get the image. You pass it the ID of the control you want to find (“capty”); it returns an object, so you need to cast/unbox it to the control typeImage. See below: