简体   繁体   中英

Accessing CustomValidator isValid Property - Visual studio 2008

I am currently using FormView to display a form using my database. I have added a customvalidator within the formview and wish to use c# to validate user entry.

As the textbox is in the form view i have used to following code to access the input:

String phoneNum = (FormView1.FindControl("NumberTextBox") as TextBox).Text;

And the following to access the custom validator:

Control CustomValidator1 = FormView1.FindControl("CustomValidator1");

when i use customValidator1.isValid, i get "does not contain a defination isValid"

I am wondering if there is a way to use the isValid property, and have i accessed the customvalidator correctly?

Thanks :P

尝试将CustomValidator1强制转换为非Control类型。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM