当前位置: 代码迷 >> ASP.NET >> 怎么重写TextBox的Text属性,需要示例
  详细解决方案

怎么重写TextBox的Text属性,需要示例

热度:5184   发布时间:2013-02-25 00:00:00.0
如何重写TextBox的Text属性,需要示例
如何重写TextBox的Text属性,需要详细的完整的示例``SOS

------解决方案--------------------------------------------------------
public class MyTextBox : System.Web.UI.WebControls.TextBox
{
public override string Text
{
get { return base.Text; }
set
{
// 验证代码
// ...
// example validation case
if(value != "csdn ") thrown new Exception( "请输入小写的csdn ");
// ...
base.Text = value;
}
}
------解决方案--------------------------------------------------------
public class usertxtbox : System.Windows.Forms.TextBox
{
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}

}
  相关解决方案