当前位置:首页 » 多媒体相关

怎样时用用户控件中的事件


我创建了一个用户控件,在页面中只有一个dropdownlist,怎样在使用这个控件的页面中使用selectedindexchanged事件??

推荐阅读

  • 15日行情:内存持续暴降 256MB跌进200 [详细内容]
  • IT [详细内容]
  • IT [详细内容]
  • 确实疯了!256M R9700宽屏笔记本跌破万元 [详细内容]
  • diy你自己的待机背景 [详细内容]
  • IT [详细内容]
  • 菜鸟看招 256MB丽台A360VE TD显卡入村 [详细内容]
  • 网友回答:
    网友:chnking

    1,在控件中声明dropdownlist时,把访问限制符protected改为public:  
      public   dropdownlist   mydropdownlist;  
      2,将此控件放置到aspx页面:  
      <uc1:webusercontrol1   id="webusercontrol11"   runat="server"></uc1:webusercontrol1></form>  
      3,在aspx.cs代码中initializecomponent()方法中加入事件挂钩:  
      this.webusercontrol11.dropdownlist1.selectedindexchanged   +=   new   system.eventhandler(this.dropdownlist1_selectedindexchanged);     //dropdownlist1_selectedindexchanged方法就是在apsx.cs中处理selectedindexchanged事件的代码

    .

    讨论区

    Login