您的位置:首页 > 其它

自定义复合Web控件

2006-03-23 17:11 267 查看

自定义复合的控件,如果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

<%@ 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"%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: