protected void rptrNewReleases_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
ImageButton imgbtnImageButton = (ImageButton)e.Item.FindControl("imgAddToCart");// (e) needs to be replaced with the "name" this image is given at runtime, but how?
imgbtnImageButton.Attributes.Add("onmouseover", "MM_swapImage('" + (e) + "','','button_addtocart_on.jpg',1)");
imgbtnImageButton.Attributes.Add("onmouseout", "MM_swapImgRestore ()");
}
The name of the image in the first Item is something like name="rptrRepeateRegion:ctl0:imgAddToCartButton"
In the second (Alternating) Item it is name="rptrRepeateRegion:ctl1:imgAddToCartButton"
and so forth...
Is there any function to get this name that ASP.NET creates?
for example: e.Item.ItemName (something like this...)
Thanks (hope this makes sense)Have you tried imgbtnImageButton.ID?
0 comments:
Post a Comment