zoukankan      html  css  js  c++  java
  • 自定义button控件处理回发事件

    创建类库项目buttonControl

    buttonControl类库项目的myButton类

    在Web应用程序中添加对该类库的引用,

    在页面中注册

    <%@ Register assembly="buttonControl" namespace="buttonControl" tagprefix="cc2" %>

    引用自定义的button控件

     <cc2:myButton ID="MyButton1" runat="server" onclick="MyButton1_Click">
      </cc2:myButton>

    后台测试:

     protected void MyButton1_Click(object sender, EventArgs e)
            {
                Response.Write("这是我自定义的按钮控件的单击事件");
            }

     如果在页面上多次调用该控件,编译器就会为每个事件委托实例生成一个字段,
     如果事件很多,则一个委托一个字段的方式看起来很浪费系统资源,
    可以采用EventHandlerList来优化。把类库项目buttonControl改为

    Code
  • 相关阅读:
    warning: already initialized constant FileUtils::VERSION
    manjaro开启sdd trim
    manjaro i3 sound soft
    archlinux or manjaro install pg gem
    rails 5.2 启动警告 warning: previous definition of VERSION was here和bootsnap
    react config test env with jest and create-react-app 1
    Python pyQt4/PyQt5 学习笔记4(事件和信号)
    MacOS 安装PyQt5
    笔者使用macOS的一些经验点滴记录1
    win7 64位系统下读写access数据库以及安装了office32位软件再安装64位odbc的方法
  • 原文地址:https://www.cnblogs.com/_dragon/p/1599909.html
Copyright © 2011-2022 走看看