Creating Web Server Controls

Creating Web Server Controls is very easy if you are using an IDE like Visual Studio .Net. With these IDE, it is a matter of simply dragging and dropping the web server control on the page in the design view.

If you are using the Visual Studio .Net you can find a Web Controls tab in the Tools palette. Just click on the tab and you can find a lot of web server controls displayed. All you have to do is to drag and drop the control to the page.

After you have dropped the control to the page, if you look at the code that is generated behind you will find that the syntax for the web server control is something like,

<tag_prefix:control_name attributes runat="server" />

For example if you have dragged a button control to the page then you might something like,

<asp:Button id="button1" runat="server" />

The web controls that you drag and drop are found in the namespace System.Web.UI.WebControls. They have a tag_prefix ‘asp’. Try creating some other web server controls in your page and check out the code.

You can also change some of the properties in the properties window and find out the changes that happen in the code behind.