Label Web Part for SharePoint Portal Server 2003 [Source Codes in C#]

Label Web Part for SharePoint Portal Server 2003

 

This web part acts like an ASP.Net label control. You can display a message or any texts on the SharePoint Web page.

 

As a good note, you can enter HTML codes in the displayed label text. For example,

Welcome to my blog: <a href=”http://www.cnblogs.com/rickie”>www.cnblogs.com</a>

<br>

Email: <a href=”mailto:[email protected]”>[email protected]</a>

 

The following code shows a portion of above web part.

protected Label lblDisplay;

 

/// <summary>

/// The required ASP.Net Label control is added to the controls collection of the web part

/// by overriding the CreateChildControls method of the base class.

/// </summary>

protected override void CreateChildControls()

{

            lblDisplay = new Label();

            lblDisplay.Width = Unit.Percentage(100);

            lblDisplay.Height = labelHeight;

            lblDisplay.Text = displayText;

 

            this.Controls.Add(lblDisplay);

}

Download source codes:
http://files.cnblogs.com/rickie/LableWebPart.zip

The following picture is a sample of label web part displayed on the SharePoint web page.
Label Web Part for SharePoint Portal Server 2003 [Source Codes in C#]

你可能感兴趣的:(SharePoint)