PANVEGA’s Blog

DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

Posts Tagged ‘Delegate Controls’

Using ASP in JavaScript for URL Encoding in SharePoint fields

Posted by PANVEGA on February 3, 2009

In this post I want to show you how to rebuild the standard MyLinks –> Add to My Links for a custom MyLinks Control in Visual Studio and using ASP in JavaScript.

Active Server Pages exposes an object called ServerVariables, which is part of the Request object. This ServerVariables object allows the programmer to see many environment variables. You can use the ServerVariables along with IIS’s directory sercurity options to determine who is currently accessing your site. You can also grab the visitor’s IP address using the ServerVariables object. This article includes a question and answer from the Activer Server Pages mailing list, as well as an excerpt from the Visual InterDev 1.0 help files detailing all of the properties of the ServerVariables object.

https://panvega.wordpress.com/2008/02/24/different-way-how-to-customize-the-mylink-in-moss (4. How to develop your custom MyLink Control in Visual Studio.) Read the rest of this entry »

Posted in ASP.NET, C#, Delegate Controls, Deployment, DotNet, JavaScript, MOSS, My Links, My Site | Tagged: , , , , , , , | 2 Comments »

Adding a Webpart into a MasterPage with a Feature

Posted by PANVEGA on January 16, 2009

The best practise, when you want to add a Webpart into a MasterPage is using a Delegate Control with a Feature.  I wanted to add a Content Query Webpart into my Masterpage Page headline with a Custom Delegate Control.  Note!  You can not add a Webpart Zone into a MasterPage just static Webparts!  Many of the controls used on default.master are loaded using the Delegate Control. These include global links such as My Site/My Links and the publishing console. So using this approach, customizing the publishing console is a simple matter of providing a replacement .ascx and creating a feature as described here!

Why using a Delegate Control?

Using the concept of a delegate control, you can take any control that exists in Sharepoint today or your own custom creations and place them on a sharepoint page such that they override the existing control at whatever scope you desire (individual site, site collection or farm) and yet require no recoding of the page(s) itself.  In previous Sharepoint versions, this involvded either customizing the pages one by one and/or creating a whole new site defintion. With the concept of delegate controls in Sharepoint 2007, its a handful of lines of code and its far more powerful.

On every Sharepoint deployment I have ever done, it has been requested that the search box be modified, either comsmetically or functionally.

Here is a short example:

<SharePoint:DelegateControl runat=”server”
ControlId=”SmallSearchInputBox”/>

The delegate control tag, the best I can deduce, does a lookup of the features on the site that will share the controlID value of “SmallSearchInputBox”. Out of the box, there is only 1 of these declared, in the feature called ContentLightup.

What you can do (as documented in the SDK) is create your own feature that uses this same controlID but refers to a different underlyling .ascx (custom control) file. The delegate control feature will then check the list of all controls with this same ID and use the one that has the lowest sequence number as declared in the <control> tag as part of another xml file in the feature

<!– using a sequence number LOWER than default of 100 so our custom control gets loaded –>

<Control
Id=”SmallSearchInputBox”
Sequence=”61″
Controlsrc=”~/_controltemplates/searcharea.ascx” mce_src=”~/_controltemplates/searcharea.ascx”>
</Control>

Only thing to note here at this stage is the ControlId attribute – the Feature we create will use this to substitute the real user/server control.

Read the rest of this entry »

Posted in Delegate Controls, Deployment, MasterPage, MOSS, WebParts | Tagged: , , , , | Leave a Comment »

Create a rotation banner in a CQWP

Posted by PANVEGA on January 13, 2009

In this post I am gonna explain how easy it is to create a custom banner function in a CQWP by adding some JavaScript code. The goal is to show a Title with a hyperlink and a short description in a rotation banner function. The Content will be referenced from a Custom SP List with these fileds. Read the rest of this entry »

Posted in Delegate Controls, JavaScript, MOSS, SPDesigner, WebParts | Tagged: , , , , , | Leave a Comment »

Javascript set the setAttibute dynamically for SharePoint Sites

Posted by PANVEGA on January 9, 2009

I have been trying to dynamically set an attribute using setAttribute() in a javaScript mehtod.

I wanna use this way to show the user which link is an external link on the Website. More detailed information in  one of my other posts.

https://panvega.wordpress.com/2008/10/12/open-link-in-a-new-window

Read the rest of this entry »

Posted in Delegate Controls, JavaScript, MOSS | Tagged: , , | Leave a Comment »

Open SharePoint Link in a new Window

Posted by PANVEGA on October 12, 2008

In SharePoint when clicking on a link the windows opens in the same window as your application. However usually you still wanna have the link to your SharePoint Site. It’s definitely not the best user experience

Add the following JavaScript Code for example to your custom UserControl .ascx and add it to your Delegate Control in your master page:

Read more about Delegate Controls in my previous post

Read the rest of this entry »

Posted in Delegate Controls, JavaScript, MOSS, SPDesigner, UserControls | Tagged: , , , , | 4 Comments »

SharePoint Delegate Controls

Posted by PANVEGA on October 12, 2008

If you don´t wann add e.g. your JavaScript Link directly into your SharePoint Page <script type=”text/javascript” language=”javascript” src=”/Style Library/XSL Style Sheets/JS/ExpandGroup.js”></script> you should use the Delegate Controls and copy the JS Code in a new created ascx UserControl.

DelegateControl that you find in a lot of places in the master pages (especially the default.master). Essentially the Delegate Control provides an alternative to adding user controls and server controls to a .aspx page in the normal way.

Read the rest of this entry »

Posted in Delegate Controls, Deployment, MOSS, UserControls | Tagged: , , | 1 Comment »

Different ways how to customize the MyLink in MOSS

Posted by PANVEGA on February 24, 2008

1. Add a hard coded link in the global links view.

Posted in Administration, C#, Delegate Controls, DotNet, MasterPage, MOSS, My Site | Tagged: , , , , , , | 1 Comment »