Build your professional network on facebook via our app Go to app
 
<< Prev  4 of 8 in Topic  Next >>
 
Industry : IT Services Functional Area : Programming Languages
Activity:  0 comments  316 views  last activity : 07 06 2010 20:18:04 +0000
Share
 
 
 

Though you can apply multiple server controls in your web form, ASP.NET allows you to create new controls according to your requirements. The controls that you create are called ASP.NET User Controls. ASP.NET User Controls have .ascx extension. The biggest advantage of ASP.NET User Controls is that it allows you to save a part of the web form and reuse it many other web forms. This drastically reduces the developers’ time.

ASP.NET User Controls are self-contained entities that are saved in an independent file. You can relate a user control with a “black box”. ASP.NET User Controls are very helpful when you want to use functionality on multiple pages of a web-application. For example, if you want to use a site navigation header or footer on all the pages of the web application, you can create this site navigation header or footer as a user control in a separate page. You do not need to place this user control on each and every page. You just have to write a few lines code to call the user control.

As ASP.NET User Controls are self-contained the developers working on the same project need not worry about transgressing on other’s code. ASP.NET User Controls offer a great deal of functionality than Server-side Includes (SSIs). Using SSIs in encapsulating the site functionality is a quite tedious task when compared to ASP.NET User Controls. You can create a user control by using the Register directive. This process is called registering the user control. For instance, you can use this code to register a user control:

<%@ Register TagPrefix="sampNamespace" TagName="Myname" src="mypage.ascx" %>

The TagPrefix is the exclusive namespace provided to the user control so that multiple ASP.NET User Controls with similar name can be discriminated from each other. The TagName is the name of the user control and the Src is the virtual path to the user control. After registering the user control you can place the tag of the user control in an appropriate location on the web form. You have to include the runat=”server” attribute with the tag.

You can create a user control using only one programming language for a web form. However, you can create multiple ASP.NET User Controls for a web form. For example, you can create a user control using C# and another user control using VB.NET and use both the ASP.NET User Controls on the same web form.

 

 
TrackBack URL:
0 comments on "Understanding User Controls in .NET Framework"
Add your comment on "Understanding User Controls in .NET Framework"

Rate:
Submit
Leading recruitment Firm
Leading recruitment Firm
Viewers also viewed
It is a boon. vs or is it a bane
 
687 referals 37 arguments, 349 views
Mind vs Brain
 
192 referals 5 arguments, 100 views
It is a general situation everywhere. Employee attrition is on rise with companies losing their...
 
1066 referals 41 arguments, 1783 views
more...  
Recent Knowledge (85)
Go to http://www.php.net/downloads.php and download the current version. PECL modules :...
40 referals 14 comments, 1003 views
India-Iran Drama Continues If Iran really was behind the February 13 attack  on an Israeli...
 
98 referals 4 comments, 72 views
Excerpt from the Book “Unposted Letter” by T. T. Rangarajan ’10 minutes early’ means I can live...
 
2078 referals 27 comments, 377 views
more...  
More From Author
What are the PIN and PUK? PIN (Personal Identity Number) is a 4-8 digit access code which can be used to secure your telephone from use. PIN2 (Personal Identity Number 2) is a 4-8 digit access code which can be used to access the priority...
I came across this interesting article on Mobile phone spying so thought I should share this information with all the community members. http://www.theregister.co.uk/2007/06/26/cell_hack_geek_spook_stalk/   
We all have seen sci-fi movies which depicted mobile phone cloning. So, if our device is cloned, the other person having the cloned device can recieve SMS, calls etc., I am not sure about the availability of cloning mechanism of mobile phones.......
more...