To register a drop-down list for postback, add the following code:
protected virtual void RepeaterItemCreated(object sender, RepeaterItemEventArgs e) { DropDownList MyList = (DropDownList)e.Item.FindControl("ddlSize"); MyList.SelectedIndexChanged += ddlSize_SelectedIndexChanged; }
And in your aspx file, add this to the repeater markup:
OnItemCreated="RepeaterItemCreated"
Then, in your ddlSize_SelectedIndexChanged function, you can access the parent control as follows:
DropDownList d = (DropDownList)sender; (RepeaterItem) d.Parent...
Hope this helps.
source share