Asp.net Repeater item cannot obtain the dropdownlist Program
Asp tutorial. net repeater item cannot get dropdownlist Program
If (! Ispostback)
{Binddata ();}
<Asp: repeater id = "repeater1" runat = "server" onitemdatabound = "repeaterincluitemdatabound">
<Itemtemplate>
<Div>
<Asp: dropdownlist id = "ddl" autopostback = "true" onselectedindexchanged = "mydrop_selectedindexchanged" runat = "server"> </asp: dropdownlist>
</Div>
</Itemtemplate>
</Asp: repeater>
Protected void repeaterincluitemdatabound (object sender, repeateritemeventargs e)
{
If (e. item. itemtype = listitemtype. item | e. item. itemtype = listitemtype. alternatingitem | e. item. itemtype = listitemtype. edititem)
{
Dropdownlist mydrop = e. item. findcontrol ("ddl") as dropdownlist;
}
}
Protected void mydrop_selectedindexchanged (object sender, eventargs e)
{
Response. write (dropdownlist) sender). selectedindex. tostring ());
}