设置自定义ASP.NET服务器控件TagPrefix的几种方法
这两天看《道不远人-----深入解析ASP.NET2.0控件开发》这本书,看完第二章内容后,想总结下“设置自定义ASP.NET服务器控件TagPrefix的几种方法”,以便以后查阅,以下面code编写的控件为例,由于重点不是控件编写,所以写了个非常简单的控件,姑且叫它EmailInput
Code
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Text;
5using System.Web;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8
9namespace ServerControl
10{
11 [ToolboxData("<{0}:EmailInput runat=server></{0}:EmailInput>")]
12 public class EmailInput : CompositeControl
13 {
14 protected RegularExpressionValidator _regValidator;
15 protected RequiredFieldValidator _rqrValidatator;
16 protected TextBox _input;
17 protected override HtmlTextWriterTag TagKey
18 {
19 get
20 {
21 return HtmlTextWriterTag.Div;
22 }
23 }
24 protected override void CreateChildControls()
25 {
26 Controls.Clear();
27
相关文档:
基于功能更丰富的基础类构建您自己的 ASP.NET 页面
发布日期 : 11/4/2004 | 更新日期 : 11/4/2004
Dino Esposito
Wintellect
适用范围:
Microsoft ASP.NET
Microsoft ASP.NET 2.0
摘要:通过继承可以在通用 Microsoft ASP.NET 类(例如 Page 类)中添加功能。这为您提供了一个公共场所,使您可以添加功能并将功能部 ......
本系列文章通过一个虚拟的案例——《MVC公告发布系统》的开发过程,全面展示了ASP.NET MVC的基本使用方法,同时在讨论了这个框架的基本原理。
这个文章系列的目的就是使朋友们更轻松的入门ASP.NET MVC。
这个系 ......
在Global.asax启动一条线程就ok了,下面是启动线程定时写文件的例子
在Global.asax
C# code:
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading" %>
<script runat="server">
string LogPath;  ......
以下是系统自动生成的回调函数
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.ons ......