当前位置:编程学习 > C#/ASP.NET >>

asp.net Repeater item 获取不到dropdownlist程序

asp教程.net  repeater item 获取不到dropdownlist程序

if(!ispostback)  
  { binddata();}
<asp:repeater id="repeater1" runat="server" onitemdatabound="repeater1_itemdatabound">  
  <itemtemplate>  
  <div>  
  <asp:dropdownlist id="ddl" autopostback="true" onselectedindexchanged="mydrop_selectedindexchanged" runat="server"> </asp:dropdownlist>  
  </div>  
  </itemtemplate>  
  </asp:repeater>  

protected void repeater1_itemdatabound(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());  
  }  

补充:asp.net教程,.Net开发
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,