0
kicks
C# Validation
Allow the different levels to enable validation for C# Visual Studio 2008 take hold. I have learned of a few valuable sites to validate your .aspx page, and if you're good, validate your .ashx pages.
The first level comes from this site. http://www.codeproject.com/KB/validation/PhoneTextBox.aspx
The said example above, is about the most basic way to code a validationControl on a <asp:TextBox> item. However, this example is beginner because they are someone who changed their program to a more customized, less embraced, format.
The control would look like this.
<asp:DropDownList ID="ddServiceDelegate" runat="server">
<asp:ListItem Value="--Select--" />
<asp:ListItem Value="1">Product Inquiry</asp:ListItem>
<asp:ListItem Value="2">Comments</asp:ListItem>
<asp:ListItem Value="3">General Assistance</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ErrorMessage="Please choose your selection."
ControlToValidate="ddServiceDelegate" InitialValue="--Select--">*</asp:RequiredFieldValidator>
Take it from there to level 2 of the programatic way to code validation.
"Validation" is another way for saying "Regular Expression Validation". The same way you would say you know politics at the age 18, and then say you know politics 30 years later. Much more complicated and complex.
* * *
http://www.c-sharpcorner.com/UploadFile/prasad_1/RegExpPSD12062005021717AM/RegExpPSD.aspx
Once you read this example, you are probably wondering how to bother. Well make a class file and call it validation. Paste all of the bool methods into the class file between :
#region Using Statements
using System;
#endregion
namespace HowToActAsOneMethod
{
public class Validation
{
public Validation()
{
//
// TODO: Add constructor logic here
//
} // end Validation
// pasted bool methods from said url here[]<>{}
}
}
The next step is up to you. Very different methods to handle different events. Try using Enumerator with your classes to delegate the responsibilities for a multithreading application.
If you get confused, just email and I can explain with snippets.