sir i have a datalist and in item template there is a imagebutton.
i want to clicking image button and want to get id of this image..
but when i click image button error occured invalid postback or callback..
i also write a autopageevent="true" or false both but error occured plz help me..
Clicking image button
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Vijay YadavRank #1,637 · 943 reputationPosted Feb 6, 2012, 8:30 PM EST
You can call the Onclick function of the Imagebutton inside the datalist itemtemplate
For ex:
protected void image_Click(object sender, ImageClickEventArgs e)
{
ImageButton img = sender as ImageButton; //This will give you current row imagebutton
if (img != null)
{
DataListItem rp = img.NamingContainer as DataListItem;
if (rp != null)
{
//statement or operation you want to perform.
}
}
}