enquires@blushmedia.co.uk
 

Controls inside controls

Menu

ImageButton inside a repeater control

Requirment to update the postback URL of an imageButton inside a repeater control:

1. Add "ItemDataBound" Event to repeater and create event in cs file
e.g controlName_ItemDataBound(object sender, RepeaterItemEventArgs e)

2. Find control inside repeater using cast:
ImageButton ib = (ImageButton)e.Item.FindControl("ImageButtonWriteResponseWithQuote");

3. Assign new PostBack url to variable ib:
ib.PostBackUrl = "MessageCreate.aspx?ID=" + ((HiddenField)e.Item.FindControl("Id")).Value.ToString();

NOTES: In order to assign the hiddenfield to the PostBackUrl I had to CAST the "Id" control to type hidden field so that I could get the value out of it.