Click here to Skip to main content
15,920,687 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my project am using Datalist control to dispaly data and also am using one imagebutton with in the datalist control if i click on image button concern file should download.So i want the code how to impement this.
Posted

1 solution

You can use Item data bound event of data list and in this event use find control to find your image button. Like this:

protected void DataList_ItemDataBound(Object sender,DataListEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
GridViewRow row = (sender as DataList).NamingContainer as GridViewRow;
if (row != null)
{
ImageButton img = row.FindControl("imbtn") as ImageButton ;
if (img != null)
{
//Here you can do code for your imgbutton
}
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900