How to use Server Controls in ASP.NET Web Page

If you are using an IDE like Visual Studio .Net there should not any problem for you to drag and drop a server control on to your web page. It will generate the code behind for the server control that you drop on your page. If you look at the code that is generated you will find that the server controls have the following syntax:

<tag_prefix:control_name attributes runat="server" />

For example if you want to validate any input that is given by the user you can use the Validating Server Controls to validate the input against any value or any range of values. By using the RangeValidator you can mention the control to validate and the MinimumValue and MaximumValue that it should have and the error text that has to be displayed if the validation fails.

<asp:RangeValidator
ControlToValidate="id_of_the_control_toValidate"
MinimumValue="minimum_value"
MaximumValue="maximum_value"
Type="Integer"
Text="Error text to be displayed"
runat="server" />

The runat=”server” indicates that it is a server control. You can use the properties, methods and events for a particular server control and use the object oriented programming model to manipulate them during runtime.