C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Adding common functionality with user controls


Posted Date: 13 Mar 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: SivaMember Level: Gold    
Rating: 1 out of 5Points: 5



User controls allow you to build your own custom controls from any other control. You can apply this to every page in your application rapidly by packaging common functionality into a reusable package. A great example of this is a menu that will be rendered on a high percentage of your Web pages. By encapsulating this functionality into a user control, you can drag and drop the control onto a Web page and move on.
Because the user control contains all the presentation and code, maintenance is reduced -- when you update the user control, all your pages will be ready to go.
For instance, the following user control adjusts the hyperlink based on the value set on the control's SourceURL property. You could position this user control on every page to provide consistent navigation to resources such as help files:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="UserControlDemo.ascx.vb"
Inherits="UserControlDemo.UserControlDemo"
%>
<LINK href="Styles.css" type="text/css" rel="stylesheet">
&tl;TABLE id="Table1" cellSpacing="0" cellPadding="0"
border="0">
<TR>
<TD align="right">
<IMG src="Images/HelpIcon.gif"></TD>
<TD>
<asp:HyperLink id="HelpHyperlink" runat="server">
User Control Demo
</asp:HyperLink>
</TD>
</TR>
</TABLE>



Siva




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Path Mapping in Asp.Net
Previous Resource: Cause button click on Enter
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use