0

i want to apply onclick event on a image in the repeater.
i don't know how to do it.
anybody having any idea plz guide me.
thanks in advance

2
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by malashukla
0

You should define image in repeater itemdatabound.
And then you can give events to image.

In repeater you can define like
HtmlImage img = e.item.FindControl("img") as HtmlImage;
or
Image img = e.item.FindControl("img") as Image;

0

thanks for your help
i have done it like this

 protected void rptthumbimg_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item)
        {
            DataRowView drv = (DataRowView)e.Item.DataItem;
            dt = obj.searchimg(4, imgcatid);
            if (dt != null)
            {
                Image imgmem = (Image)e.Item.FindControl("imgthumb");
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["thumbnail"].ToString() == "")
                    {
                        imgmem.ImageUrl = impplaces + "memimg.png";
                    }
                    else
                    {
                        imgmem.ImageUrl = impplaces + dt.Rows[0]["thumbnail"].ToString();
                    }
                }
            }
        }
    }

i want to implement onclick event on this image and i dont know hoe to do it.

Edited by Nick Evan: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.