Lets create a user control which will display the login name of user.
Below steps needs to be performed.
Step-1:
VS --> empty Sharepoint Project --> Add user control (UControl)
Add below code in aspx page
2. Register the user control at the top of the page.
<%@ Register TagPrefix="MyUserControl" TagName="UserName" Src="~/_controltemplates/MyUserControl/MyUserControl.ascx" %>
Below steps needs to be performed.
Step-1:
VS --> empty Sharepoint Project --> Add user control (UControl)
Add below code in aspx page
<
div
id
=
"Main"
style
=
"border:1; background-color:#2C84CA; font-size: 25px; color:White;"
>
<
asp:Label
ID
=
"lblUserName"
runat
=
"server"
Text
=
"0"
></
asp:Label
>
</
div
>
SharePoint 2010 add user control to page
1. Open SharePoint designer, Open the target site, and then Default.aspx in advanced mode.2. Register the user control at the top of the page.
<%@ Register TagPrefix="MyUserControl" TagName="UserName" Src="~/_controltemplates/MyUserControl/MyUserControl.ascx" %>
No comments:
Post a Comment