Click here to Skip to main content
15,913,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to validate textbox at server side
Posted
Updated 19-Jul-11 4:05am
v2
Comments
walterhevedeich 19-Jul-11 2:09am    
Perhaps you need to describe more in detail what type of validation do you want for the textbox. We might just be making assumptions and may give answers that you don't really need, given a statement like this.
Dave Kreskowiak 19-Jul-11 10:06am    
I modified the tags as, by your description, this sounds like your using ASP.NET (Web Forms) and not Windows Forms.

Use CustomValidator server control for server-side validation.
http://msdn.microsoft.com/en-us/library/aa479013.aspx[^]
Check Listing 15
 
Share this answer
 
Provided the textbox has runat="server", then just access it via it's name, and use the Text property.
 
Share this answer
 
To validate at server server side, there are 2 ways,

Either use validation control or validate manually.

1. To apply validattion using validation control you can use CustomValidator. Using this control you can apply client side validation as well.

Check the following link to get the idea of all the validation control,

http://www.w3schools.com/aspnet/aspnet_refvalidationcontrols.asp[^]


2. To Validate manually, just check your control value from code at server side and show message on label if the data is invalid.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900