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:rickieleemail@yahoo.com”>rickieleemail@yahoo.com</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:
https://files.cnblogs.com/rickie/LableWebPart.zip

The following picture is a sample of label web part displayed on the SharePoint web page.

posted @ 2004-07-20 10:53  Rickie  阅读(750)  评论(0编辑  收藏  举报