自定义Textbox控件中RequiredFieldValidator在IE9、IE10下失效
[DefaultProperty("Text"), ToolboxData("<{0}:TextBox runat=server></{0}:TextBox>"), Designer("")]public class TextBox: System.Web.UI.WebControls.TextBox
{
protected RequiredFieldValidator nameValidator = new RequiredFieldValidator();
protected override void CreateChildControls()
{
nameValidator.Display = System.Web.UI.WebControls.ValidatorDisplay.Dynamic;
nameValidator.ControlToValidate = this.ID;
nameValidator.ErrorMessage = "请务必输入内容";
this.Controls.Add(nameValidator);
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
RenderChildren(writer);
}
}
调用为:<cc1:TextBox runat="Server" ID="txtTest" />
在IE6,IE7,IE8下可以正常提示,但是在IE9,IE10,firefox和chrome下没有验证提示
望坛子里的高手指点下。 --------------------编程问答-------------------- apsx页面加个这个试试 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> --------------------编程问答-------------------- 这个IE10可以了,不过chrome和firefox还是不行的。这个只有ie下生效
补充:.NET技术 , ASP.NET