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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.