Pages

IMG

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

mercredi 23 novembre 2011

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 Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES" 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

2 commentaires:

Anonyme a dit…

@


i am getting unknown server tag error. i have followed same steps.

Jeff a dit…

Hello, could you post the code you are using ?

Regards,

Jeff ANGAMA

 

Blogroll

Jeff ANGAMA, is Office 365 / SharePoint Consultant. Started on MOSS2007 - More Infos Here -

RSE

Rechercher dans ce blog

Where Users are from ?