自定义复合的控件,如果Winform中的控件一样
1:需要单独为其建一个项目,生成的文件以.dll为后缀名
2:使用的时候,添加引用,或者在工具箱中添加
3:如果自己手动添加则:在HTML头添加注册

<%@ Register TagPrefix="Custom" NameSpace="webcustomercontrol1" Assembly="webcustomercontrol1"%>

NameSpace 是控件的命名空间,Assembley是生成的程序集的名称,就是dll文件名.
4在form中<custom 类名 runat="server"/>
下面举几个例子详细说明:

  1. 第一个例子的效果图是这样:
    点击加的按钮时计算文本框中数字和,数字与数字之间以回车分隔
      1自定义复合Web控件using System;
      2自定义复合Web控件using System.Web.UI;
      3自定义复合Web控件using System.Web.UI.WebControls;
      4自定义复合Web控件using System.ComponentModel;
      5自定义复合Web控件
      6自定义复合Web控件namespace csMathControl
      7




<%@ Register TagPrefix="Custom" NameSpace="csMathControl" Assembly="csMathControl"%><%@ Register TagPrefix="Custom" NameSpace="csMathControl" Assembly="csMathControl"%><%@ Register TagPrefix="Custom" NameSpace="csMathControl" Assembly="csMathControl"%><%@ Register TagPrefix="Custom" NameSpace="csMathControl" Assembly="csMathControl"%>

相关文章:

  • 2021-09-30
  • 2021-11-26
  • 2021-11-11
  • 2022-12-23
  • 2021-05-31
  • 2021-08-17
猜你喜欢
  • 2022-12-23
  • 2021-10-25
  • 2022-03-06
  • 2021-12-04
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案