How do you register a user control?

Posted by Udaysimha under ASP.NET on 2/18/2012 | Points: 10 | Views : 1195 | Status : [Member] | Replies : 2
Hi All,
Please let me know how we can register a user control.
Thanks

uday


Responses

Posted by: Sksamantaray on: 2/19/2012 [Member] Silver | Points: 25

Up
0
Down

You can Register a user an user control in page directive like

<%@ Register TagPrefix="TagPrefixName" TagName="TagName" Src="Controls/Header.ascx" %>

Then in the page use it like:
<TagPrefixName:TagNamer ID="MyHeader" runat="server" />

Thanks,
Sanjay

Udaysimha, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 2/19/2012 [Member] Silver | Points: 25

Up
0
Down

You can also register an user control in web.config file and use it many pages.
 <system.web>


<pages>
<controls>
<add TagPrefix="yourTagPrefixName" TagName="yourTagName" src="~/Controls/Header.ascx"/>

</controls>
</pages>

</system.web>


Thanks,
Sanjay

Udaysimha, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response