I'm doing some tests with the AssetUrlSelector control to improve user experience in a SharePoint 2007 environment.
The AssetUrlSelector control gives your end users a nice interface for selecting a link or image URL from a site collection. You can read the MSDN documentation here:
AssetUrlSelector Class (Microsoft.SharePoint.Publishing.WebControls)
By default it renders a textbox and a button which gives you the selection interface but you can also bind it to your own controls. In the latter case you can hide the default textbox and/or button. Both scenario's are neatly explained in the MSDN docs (see link above).
Here's a quick sample of using the AssetUrlSelector in a WebPart:
public class BrowseButtonWebPart : WebPart
{
protected override void CreateChildControls()
{
Label lblUrl = new Label();
lblUrl.ID = "lblUrl";
lblUrl.Text = "Url: ";
Controls.Add(lblUrl);
TextBox txtUrl = new TextBox();
txtUrl.ID = "txtUrl";
Controls.Add(txtUrl);
AssetUrlSelector picker = new AssetUrlSelector();
picker.ID = "ausUrl";
picker.AssetUrlClientID = txtUrl.ClientID;
picker.AssetUrlTextBoxVisible = false;
Controls.Add(picker);
}
}
And this is the result on screen:
Note that it's only available in MOSS 2007 since it's part of the Microsoft.SharePoint.Publishing namespace !