Thursday, March 22, 2012

html control and webserver control

in asp.net 1.1

we have html controls and webserver controls

For html controls, if we set the attribute called runat="server", then will that html control turn in webserver control?

then what is the use of having two different catogeries?

Putting a runat="server" in html controls will make them html server controls. The difference between these are that you can only do client-side scripting with HTML Controls whereas with HTML server controls or webserver controls you can control them via server side or client side scripting. HTML controls are basically not being processed by the server itself so their state are not kept across page loads so you can find that these controls render much faster compared to server controls.

Don't know much about why they included HTML server controls but I guess MS wanted to make it easy for developers to move older applications to .NET. It'd be too much of a hassle to start from scratch all over again. This way you can just add a runat="server" attribute to HTML controls.

Web server controls are classes that makes it easier for developers to make controls that look similar to winforms UI which if one would make in pure html code would take quite a while like the datagrid for example. These controls are also being rendered to the client as html controls. Very useful if you would like to have control over customization of your UI.


if we add runat=server attribute to html standard controls then it will become html server controls.One way this is going to useful in conversion projects like from asp to asp.net.More over some of the web server controls(eg calendar ,etc) are more sophisticated as well as rich UI which u cant find in standard html controls.

Below is a link which will give you a good idea about the difference between

Html Controls VS web server controls

HC

-----

Mark it as answered if it helped you

No comments:

Post a Comment