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 |

 

“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

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

Copyright - © 2004 - 2024 - All Rights Reserved.