I have a nested repeaters, i.e. a parent repeater and a child repeater. The child repeater contains only one DropDownList control. I have OnSelectedIndexChanged setup on DropDownList control. I can get the index of the child repeater item when the drop down list's selection is changed.
My question is: How can I get the index of the parent repeater in which the drop down list's selection was changed.
Here is the sample code:
<asp:Repeater runat="server" ID="ParentRepeater">
<ItemTemplate>
<asp:Repeater runat="server" ID="ChildRepeater">
<ItemTemplate>
<asp:DropDownList runat="server" ID="DropDownInChildRepeater" OnSelectedIndexChanged="DropDownInChildRepeater_OnSelectedIndexChanged" />
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
protected void DropDownInChildRepeater_OnSelectedIndexChanged(object sender, EventArgs e)
{
var dropDownInChildRepeater = (DropDownList)sender;
var dropDownInChildRepeaterItem = (RepeaterItem)dropDownInChildRepeater.NamingContainer;
var indexOfDropDownInChildRepaterItem = dropDownInChildRepeater.ItemIndex;
//Question I need index of ParentRepeater in which sender resides
}