我写了CustomValidator控件的代码如下:
public void CustomThis(object sender, ServerValidateEventArgs args)
{
string str = "";
str += TextBox11.Text;
str += DropDownList2.SelectedItem.Text;
str += DropDownList3.SelectedItem.Text;
            
string temp = TextBox9.Text.Substring(6,8); if( string.Compare(str, temp) == 1)
args.IsValid = true;
else
args.IsValid = false;
                     }
这个控件的目的是:提取输入的身份证(TextBox9)第六位开始以后的八位是出生的年月日,然后和出生的年、月、日信息(年:TextBox11;月:DropDownList2;日:DropDownList3)进行比较相同通过,不相同显示出错信息。 可是我在提交的时候并没有执行这段代码,无论我输入什么他都通过,请问是为什么?属性为:ControlToValidate="TextBox9"