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.





______________________________________________________

Recommended Resource



| Why should you go for Server Controls | Advantages of using .NET Server Controls | Understanding ASP.NET Server Controls | Creating Web Server Controls | Server Side Controls in ASP.Net | Creating Custom Server Controls | Server Controls in ASP.NET Web Page | Using Html Server Controls in your Web Pages | Understanding Dynamic Server Controls in ASP.NET | Using ASP Server Controls Templates | Developing ASP.NET Server Controls | Setting properties for ASP.NET Custom Server Controls | Implementing ASP.NET Server Side Controls | Creating Professional ASP.NET Server Controls |



_______________

FREE Subscription

Stay Current With the Latest Technology Developments Realted to .NET. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.


 

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.