Difference Between ASP.NET Server Controls and HTML Controls



ASP.NET Server Controls:
1. ASP .NET Server Controls can however detect the target browser’s capabilities and render themselves accordingly. No issues for compatibility issues of Browsers i.e page that might be used by both HTML 3.2 and HTML 4.0 browsers code to be written by you.
2. Newer set of controls that can be used in the same manner as any HTMl control like Calender controls. (No need of Activex Control for doing this which would then bring up issues of Browser compatibility).
3. Processing would be done at the server side. In built functionality to check for few values(with Validation controls) so no need to choose between scripting language which would be incompatible with few browsers.
4. ASP .NET Server Controls have an object model different from the traditional HTML and even provide a set of properties and methods that can change the outlook and behavior of the controls.
5. ASP .NET Server Controls have higher level of abstraction. An output of an ASP .NET server control can be the result of many HTML tags that combine together to produce that control and its events.
1. The control of the code is inbuilt with the web server controls so you have no much of direct control on these controls
2. Migration of ASP to any ASP.NET application is difficult. Its equivalent to rewriting your new application
HTML Controls:
1. The HTML Server Controls follow the HTML-centric object model. Model similar to  HTML
2. Here the controls can be made to interact with Client side scripting. Processing would be done at client as well as server depending on your code.
3. Migration of the ASP project thought not very easy can be done by giving each intrinsic HTML control a runat = server to make it HTML Server side control.
4. The HTML Server Controls have no mechanism of identifying the capabilities of the client browser accessing the current page.
5. A HTML Server Control has similar abstraction with its corresponding HTML tag and offers no abstraction.
1. You would need to code for the browser compatibility.

Ajax CalendarExtender Example In Asp.Net -Change date format and show calendar when click on button



In this article I will explain how to use Ajax Calendar extender control in asp.net and how to change date format in ajax calendar control and display calendar control when click on image button in asp.net. First create one new website and add AjaxControlToolkit reference to your application after that write following line in your aspx page


<%@ Register Namespace=”AjaxControlToolkit” Assembly=”AjaxControlToolkit” tagPrefix=”ajax” %>

Once we add above references design your aspx page will be likes this
<%@ Register Assembly=”AjaxControlToolkit” Namespace=”AjaxControlToolkit” TagPrefix=”ajax” %>
<head runat=”server”>
<title>Ajax Calendar extendar control exmaple in asp.net</title>
<form id=”form1″ runat=”server”>
<ajax:ToolkitScriptManager ID=”toolkit1″ runat=”server”></ajax:ToolkitScriptManager>
<td><b>Select Date:</b></td>
<asp:TextBox ID=”txtDate” runat=”server” />
<ajax:CalendarExtender ID=”CalendarExtender1″ TargetControlID=”txtDate” Format=”dd/MM/yyyy”runat=”server”>
<td><b>Select Date</b></td>
<asp:TextBox ID=”txtDate1″ runat=”server”/> <asp:ImageButton ID=”imgbtnCalendar” runat=”server”ImageUrl=”~/Calendar.png” />
<ajax:CalendarExtender ID=”CalendarExtender2″ TargetControlID=”txtDate1″PopupButtonID=”imgbtnCalendar” runat=”server” />
If you observe above code I define some of properties to ajax:CalendarExtender now I will explain all the properties of Ajax rating control
TargetControlID – The ID of control which is used to show calendar control when click on textbox or calendar image icon.
PopupButtonID – This property is used to set ID of control which is used to show calendar control when click on it.
PopupPosition – This property is used to indicate position of the calendar control when clicked on textbox.
SelectedDate – This property is used to set date of calendar control which is initially showed.