0

Hi All,
Im new to ASP.NET & C#. I have designed a webpage where a user has to give his details like Name, Age, Sex, Location and subnit it to another page. Now it works even if the user gives details only about his name & sex. SO im trying to program it in such a way that only if the user enters all the details, he should be able to submit. I have heard of something called Validation COntrols. I hope I have to make use of this mechanism for my purpose. Hence when I browsed in the net, I came to know about 5-6 functions of Validation COntrols. But im not sure how to incorporate them in my code. COuld anyone help me out?
Thanks.
Kally

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by yasserstein
0

as you're trying to enable validation in a webpage, why not use JavaScript?

else, you can still implement regular expressions in your code to check on input fields. this you can do in your backbone c#-code as follows. first include the following library.

using System.Text.RegularExpressions;

then, create a Regex object and join it with a regular expression. if you have difficulties with that, i'd be glad to help.

Regex exp = new Regex(@"...");

hope this helped
pygmalion

0

you can use the RequiredFieldValidator in VS validation controls.
using this control is extremely easy. you just set the ControlToValidate field with the control you need to set as required, and you enter some text for the ErrorMessage and you're done.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.