C# 页面。Isvalid是否始终返回false?
我有两个按钮,每个按钮有两个单独的验证组。我在文本框的每个requiredfield验证器上保留了C# 页面。Isvalid是否始终返回false?,c#,asp.net,validation,C#,Asp.net,Validation,我有两个按钮,每个按钮有两个单独的验证组。我在文本框的每个requiredfield验证器上保留了EnableClientScript=false。我有下面这样的c代码 void submitButton_Click(object sender, EventArgs e) { this.Page.Validate("LoginAccountGroup"); if (this.Page.IsValid) { } } void saveButton_Click(o
EnableClientScript=false
。我有下面这样的c代码
void submitButton_Click(object sender, EventArgs e)
{
this.Page.Validate("LoginAccountGroup");
if (this.Page.IsValid)
{
}
}
void saveButton_Click(object sender, EventArgs e)
{
this.Page.Validate("CreateAccountGroup");
if (Page.IsValid)
{
}
}
我的问题是这个页面。Isvalid
在c#code中总是返回false。如何让它工作试试这个
protected bool IsGroupValid(string sValidationGroup)
{
Page.Validate(sValidationGroup);
foreach (BaseValidator validator in Page.GetValidators(sValidationGroup))
{
if (!validator.IsValid)
{
return false;
}
}
return true;
}
除了这两个控件之外,还有其他控件进行验证吗?因为page.validate语句在所有验证器都为true时返回true。您不能直接在标记中的按钮(即.aspx页面)上设置ValidationGroup吗?这与