in SharePoint 2007

Customizing the AssetUrlSelector

One of the very useful SharePoint Publishing Controls is the AssetUrlSelector

This control allows users to pick any asset (images or documents or files or pages etc.,) from the site collection

Below is an example of how this control looks when you add it to your page

asset-picker-control

Below is the picker dialog

asset-picker-dialog

If you want to customize the AssetUrlSelector control, you can do so by modifying some of its properties

For example, below is an example code segment:

 

<%@ Register TagPrefix="PublishingWebControls"

    Assembly="Microsoft.SharePoint.Publishing, 

                   Version=12.0.0.0,

                   Culture=neutral,

                   PublicKeyToken=71e9bce111e9429c"

    Namespace="Microsoft.SharePoint.Publishing.WebControls" %>

<PublishingWebControls:AssetUrlSelector ID="urlVideoSelector"

    IsUrlRequired="true"

    UseImageAssetPicker="false"

    AllowExternalUrls="false"

    runat="server"

    DefaultOpenLocationUrl="~Site/Video Library/Forms/AllItems.aspx"

    OverrideDialogTitle="Video Picker"

    OverrideDialogDescription="Select a video" />

 

As you can see in the above code snippet, I have customized few things:

1) Default open location

2) Picker Dialog title

3) Picker Dialog description

The UseImageAssetPicker is an interesting property which when set to true will open the Images library in the top level site, which is quite handy!

Getting the Url of the selected asset via code is very simple:

string videoUrl = urlVideoSelector.AssetUrl;

Visit this MSDN page for more customization options on the AssetUrlSelector control

Write a Comment

Comment

Time limit is exhausted. Please reload the CAPTCHA.