How do we register User-Control onto a web page?

 Posted by vishalneeraj-24503 on 12/6/2013 | Category: ASP.NET Interview questions | Views: 2288 | Points: 40
Answer:

We the help of @Register directive,we can register any User-controls in a webpage.

For ex:- We have to write @Register directive at the top of the page like below:-

<%@ Register Src="~/WebUserControl.ascx" TagName="abc" TagPrefix="uc">

Here:- WebUserControl.ascx is a User-Control name.
TagPrefix :- like an <asp: tag
TagName :- like control object

For accessing user-control,we have to write onside<body> tag
as:-

<uc:abc ID="my_user_control" runat="server" />


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response