Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Why we use runat=server with validation controls like RequiredFieldValidator in asp.net.As this validator execute on client side?
Posted
Comments
Richard C Bishop 12-Aug-13 12:52pm    
It does not run on the client side. The "runat=server" indicates that it runs on the server. What makes you think it is client side?
ZurdoDev 12-Aug-13 12:59pm    
I'm sure the OP means that since the validation of the validation control actually takes place on the client.
Richard C Bishop 12-Aug-13 13:05pm    
That is probably a safe assumption, however, I had hoped to get the OP to do a little bit of critical thinking.
ZurdoDev 12-Aug-13 13:09pm    
You know better. :)
Richard C Bishop 12-Aug-13 13:40pm    
A guy and dream though....

1 solution

The runat=server allows you to access the properties in C# code behind. So, you could dynamically change settings on Page Load for example based on other inputs you might have.

But in this case, you are right, the actual validation happens client side.

You can even put a runat=server on a div tag or other html tag, give it an id, and then access it in server side code. I've needed to do that sometimes.
 
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