HomeDevelopment (Old) Create User Control in SharePoint 2010 MasterPage

[SharePoint 2010 – Developpement] Create User Control in SharePoint 2010 MasterPage

Today we need to create a user control that modify SharePoint Logo behaviour :
-We want to redirect the user to a site if the user is in a subsite

Procedure :

Add a UserControl in your SharePoint Visual Studio project

  1. Create a new element in visual studio, it will create files in ControlTemplates

image
Deploy the project
Go to “C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATECONTROLTEMPLATES” in order to see the full link of your userControl that you are gonna use in the next step
Reference your UserControl in the masterPage thanks to, and adapt the link :

   1: <%@ Register Src="~/_controltemplates/yourprojectName/Logos.ascx" TagName="Logos" TagPrefix="uc1" %> 

Reference the userControl in the masterPAge :

   1: <uc1:Logos id="Logos1" runat="server"> </uc1:Logos >        

Code the user control thanks to the .cs

How to debug a user control :

It’s possible to debug the user control, by attaching all Sharepoint Processus (see CKSDev Extension for visual studio)

image

- Advertisement -

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

CONNECT FOR MORE CONTENT

DO NOT MISS THOSE ARTICLES

Recent Comments