Click here to Skip to main content
15,907,183 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to use the .ascx user control in default.aspx in vs2005?
Posted
Comments
Anuja Pawar Indore 7-Feb-12 0:52am    
To lazy to Google even

The easiest way is to add a user control to a webpage by simply dragging it from Solution Explorer to a webpage in Design view. When you add the user control to a page, you can see the control’s visual makeup in Design view. If you switch to Source view, you can see the markup information that Visual Studio added to your page

It can also be done manually by doing two things:
Add the following line in the aspx page just after the Page directive:

VB
<%@ Register src="UserControl.ascx" tagname="UserControl"
tagprefix="uc1" %>


Then you can start using the control within the form tag like any other aspnet control as shown below:

VB
<uc1:userControl ID="userControl1" runat="server"
someTypeProperty="Home" />


Please go through this msdn link for more information http://msdn.microsoft.com/en-us/library/sbz9etab.aspx[^]
Hope this helps.
 
Share this answer
 
Follow the tutorials mentioned in below link. It have step by step guide on user control usage in .net

Link [^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900