You have to search through the DropDownList
's NamingContainer
. The flow should be like this:
(DropDownList)sender
--> NamingContainer(Child RepeaterItem)
--> NamingContainer(Child Repeater)
--> NamingContainer(Parent RepeaterItem)
--> FindControl"Hdhotelname" (Hdhotelname)
and your code should be like this:
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
var ddl = (DropDownList)sender;
var rptChild = ddl.NamingContainer.NamingContainer;//Child Repeater
if (rptChild != null)
{
var rptParentItem = rptChild.NamingContainer;//Parent RepeaterItem
var hdnfld = rptParentItem.FindControl("Hdhotelname") as HiddenField;
if (hdnfld != null)
{
//Do your tasks
}
}
}
Hope it helps!