自定义复合的控件,如果Winform中的控件一样
1:需要单独为其建一个项目,生成的文件以.dll为后缀名
2:使用的时候,添加引用,或者在工具箱中添加
3:如果自己手动添加则:在HTML头添加注册<%@ Register TagPrefix="Custom" NameSpace="webcustomercontrol1" Assembly="webcustomercontrol1"%>NameSpace 是控件的命名空间,Assembley是生成的程序集的名称,就是dll文件名.
4在form中<custom 类名 runat="server"/>
下面举几个例子详细说明:
- 第一个例子的效果图是这样:
点击加的按钮时计算文本框中数字和,数字与数字之间以回车分隔1using System;
2using System.Web.UI;
3using System.Web.UI.WebControls;
4using System.ComponentModel;
5
6namespace csMathControl
7