In part 1 we talked about ASP.NET and .NET Framework 3.5 in general and got accross some of the very basic concepts of .net technology. now we move on to ASP.NET Controls often termed as the heart of the .NET Framework.
There are around 70+ Controls in ASP.NET Framework and are categorized as follows.
- Standard Controls
- Data Controls
- Validation Controls
- Navigation Controls
- Login Controls
- WebParts Controls
- HTML Controls
- AJAX Extentions
Standard Controls – as the name suggests this category contains all the basic controls in order to fullfil the web interface related requirements such as text boxes, hyperlinks, buttons, tables and many more.
Data Controls – A number of useful data controls are available for the developer to easily communicate with database and efficiently display them to the end user. GridView, ObjectDataSource, Repeater are few of the most popular data controls.
Validation Controls - these controls come in very handy when we need to apply any sort of validations on the standard controls such as Required field validation on Textbox, Data Type validation, Regular Expression Match and many others.
Navigation Controls – navigation controls make things very comfortable when it comes to manage navigation of your website for example generating SiteMaps, Menus and TreeView.
Login Controls – these controls are there to be used whenever you need to implement security to your website, they enable you to display login, change password and registration forms.
WebParts Controls – these controls enable end users to modify the content, appearance, and behavior of Web pages in the web browser itself.
HTML Controls - these are standard HTML controls such as textboxes, anchor, checkboxes and any other HTML control you would know. it also gives the ability to convert any HTML tag into a server control.
AJAX Extensions – this category contains some very helpful AJAX related controls which enables AJAX on your pages magically ( well seems like magic ), for example if you want to change text of some label on the web page by a button’s click event using AJAX (without posting the entire page back) all you need to do is put that label and button in a UpdatePanel and that’s just about it!
we will learn about each of them in the detail in the later parts.
Event Handlers
Almost all of the ASP.NET controls provides one or more Events to support the idea of event driven web application. for example if you want that on a certain click of a button a text should change on the web page would require a Click Event of the Button to be raised when clicked and subsequently changing the text of the label placed somewhere on the page.
the code below demonstrates this example
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void btnSubmit_Click(object sender, EventArgs e)
{
lblMessage.Text = "Button has been Clicked";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>DotToString - My First Website</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblMessage" runat="server" Text="Click on the Button Below" ></asp:Label><br />
<asp:Button ID="btnSubmit" runat="server" Text="Click"
onclick="btnSubmit_Click" />
</div>
</form>
</body>
</html>
In this example Two ASP.NET controls are used, Label and Button. I have placed an onclick event which is handled by btnSubmit_Click Event Handler to change the text of the Label control.
In the part 3 I will demonstrate some samples codes (using Microsoft Visual Studio 2008) which will further elaborate the use of ASP.NET Controls and their Event Handlers.
keep visiting and don’t forget to leave feedback.
Cheers!
Proceed to:
- ASP.NET Tutorials – [Part 03] ASP.NET 3.5 Controls and Event Handlers II
-
ASP.NET Tutorials – [Part 04] ASP.NET 3.5 Controls and Event Handlers III
Previous Parts:


