CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: delegatectontrol

Google Analytics in Sharepoint

Google Analytics is a popular and mature tool for monitoring network activities on your site. Why not use it in Sharepoint? Dave Coleman and Mike Knowles provide good guides for doing that. There is a promising plugin to SP SPGoogleAnalytics which integrates both and provides an easy interface to put GA to your SharePoint installation and see the data directly on your intranet. It comes from codeplex:

What do you think about spgoogleanalytics.codeplex? When I recently had to turn on Google Analytics on an intranet, I had no time for evaluating SPGoogleAnalytics, so I did the harder way: just put ga script in the end of a master page, just before ending </body> tag.

But what if one has multiple masterpages? Is there a way to put GA in one step? Maybe a user control like Knowles suggests?

Change the layout of Search Box without custom delegate control

The surest way to customize Search box in Sharepoint is to create a delegate control. In Sharepoint.Stackexchange there are many links to resources about this. But if you don’t have access to server or can’t deploy, the easiest way to do it is to style it with css. Thanks Steve Ottenad.

 

.s4-search .ms-sbgo a {
   background:url(../images/search_btn.png) no-repeat; 
   width:27px; 
   height:22px; 
   display:block; 
}
.s4-search .srch-gosearchimg, .s4-search .ms-sbgo span { 
   display:none; 
}

First we hide the the default image and then we add our image for search button as background.

Create own delegate control

In this post I’ll show how to create a simple (but own) delegate control.
A short intro and links on delegate controls can be found on sharepointoverflow.

Take a look on master page. There are already many delegate controls. The delegate control with id AdditionalPageHead can be used for adding your script or jQuery library.:

<SharePoint:DelegateControl 
    runat="server" 
    ControlId="AdditionalPageHead" 
    AllowMultipleControls="true"/>

You can also override existing controls like searchbox. But what if you want to add some content in the master page where no delegate controls are present. Of course, you can add it directly to the master page. Perhaps not on all webs? You can use placeholders to manage it. But do you want to update all the page layouts?

So the solution is to use delegate controls, for adding multiple pieces of content or overriding using Sequence. In this example I’ll add some new content to the quicklaunch bottom area:

<SharePoint:UIVersionedContent 
	UIVersion="4" runat="server" 
	id="PlaceHolderQuickLaunchBottomV4">
	<ContentTemplate>

Now we’ll create a brand new delegate control. Just add it after ContentTemplate:

<SharePoint:DelegateControl runat="server" 
     ControlId="AdditionalQuickLaunchArea" 
     AllowMultipleControls="true"/>

In your Visual Studio project add a mapped folder for CONTROLTEMPLATES and add a new user control: MyText.

Just write some text in the user control.

Add a new empty element:

Reference to your user control in the elements.xml file:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control Id="AdditionalQuickLaunchArea" 
           ControlSrc="~/_CONTROLTEMPLATES/MyText.ascx" 
           Sequence="1000" />
</Elements>

Now deploy to your site and see the difference:

This is just a simple tutorial which shows how to start developing a custom delegate control, only for demonstration purpose only. No formatting or good solution design have been payed attention.

Here is the original s4-leftpanel section from v4 without v3 ui versioned controls:

Read more of this post

Вула Чăвашла

VulaCV - Чăвашла вулаттаракан сайт

Discovering SharePoint

And going crazy doing it

Bram de Jager - Coder, Speaker, Author

Office 365, SharePoint and Azure

SharePoint Dragons

Nikander & Margriet on SharePoint

Paul J. Swider - RealActivity

RealActivity is a specialized Microsoft healthcare services and solution advisory firm.

Cameron Dwyer

Office 365, SharePoint, Azure, OnePlace Solutions & Life's Other Little Wonders

paul.tavares

Me and My doings!

Share SharePoint Points !

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

Aryan Nava

DevOps, Cloud and Blockchain Consultant

SPJoel

SharePoint for everyone

SharePointRyan

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint

blksthl

Mostly what I know about SharePoint - CommunicoCuspis