设置自定义服务器控件的TagPrefix
2006-08-07 18:25
232 查看
1 为服务器控件添加ToolboxData属性
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace WebControlLibrary1
{
[ToolboxData("<{0}:WebCustomControl runat=server></{0}:WebCustomControl>")]
public class WebCustomControl : System.Web.UI.WebControls.WebControl
{
}
}
其中ToolboxData中的WebCustomControl 为服务器控件类的名称
2 为服务器控件的Assembly.cs文件添加如下信息
using System.Web.UI
[assembly:TagPrefix("WebControlLibrary1","mycontrol")]
TagPrefix属性位于System.Web.UI命名控件下,所以要引用System,Web.UI命名空间
TagPrefix原型为[assembly:TagPrefix("namespace","tagprefix")]
这样生成的控件被拖拽到页面上就会生成一下的代码
<mycontrol:WebCustomControl1 runat="server"></mycontrol>
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace WebControlLibrary1
{
[ToolboxData("<{0}:WebCustomControl runat=server></{0}:WebCustomControl>")]
public class WebCustomControl : System.Web.UI.WebControls.WebControl
{
}
}
其中ToolboxData中的WebCustomControl 为服务器控件类的名称
2 为服务器控件的Assembly.cs文件添加如下信息
using System.Web.UI
[assembly:TagPrefix("WebControlLibrary1","mycontrol")]
TagPrefix属性位于System.Web.UI命名控件下,所以要引用System,Web.UI命名空间
TagPrefix原型为[assembly:TagPrefix("namespace","tagprefix")]
这样生成的控件被拖拽到页面上就会生成一下的代码
<mycontrol:WebCustomControl1 runat="server"></mycontrol>
相关文章推荐
- 设置自定义服务器控件的TagPrefix
- 【记录】自定义服务器验证控件
- Flex中如何通过设置toolTipField属性在ButtonBar控件中设定自定义tool tip的例子
- 自定义组合控件动态,静态设置属性的步骤
- 自定义服务器控件ViewSuo的源文件
- TS\RDS服务器安全设置系列四 禁用或自定义控制面板
- 开发和使用自定义服务器控件(一)
- 生成自定义服务器控件示例(app_code引用)
- asp.NET自定义服务器控件内部细节
- Android控件动态加载的tag设置
- 在ListCtrl控件中设置自定义光标
- ASP.NET2.0服务器控件之自定义状态管理
- 自己实现的数据表格控件(dataTable),支持自定义样式和标题数据、ajax等各种自定义设置以及分页自定义
- 在自定义的view中设置activity的控件
- 自定义服务器控件之:带验证功能文本框控件 TextBox (Only For IE)
- Android:自定义Activity基类,复用布局/控件,减少设置控件的重复代码,onPostOnCreate
- Asp.net自定义服务器控件开发小技巧: 如何正确获得回传数据
- 自定义服务器控件开发
- 服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止
- 缺省HTML FORM导致自定义服务器控件脚本无法注册