如何定义和调用类
举例
定义Error.cs类
public class Error:System.Web.UI.Page
{
public void Errormsg(string sqldate)
{
//加入时间限制
System.DateTime currentTime=new System.DateTime();
currentTime=System.DateTime.Now;
if(DateTime.Parse("2006-12-31") <= currentTime )
{
this.Response.Redirect("Error.htm");
}
}
}
然后在页面a.aspx中继承这个类
public class DeptDict : Error
直接调用
Errormsg("2006-07-23");
就可以了。
以前没有做过,特别整理一下,学习。