csharp 具有一个可自定义属性的简单SharePoint WebPart示例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 具有一个可自定义属性的简单SharePoint WebPart示例相关的知识,希望对你有一定的参考价值。
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
//using Microsoft.SharePoint.WebPartPages;
namespace SharePointProject1.WebPart1
{
[ToolboxItemAttribute(false)]
public class WebPart1 : WebPart
{
private string strTheMessage;
[WebBrowsable(true), Category("Miscellaneous"),
DefaultValue("Test me.."),
Personalizable(PersonalizationScope.User),
WebDisplayName("Test this"),
WebDescription("Enter the message")]
public string MyMessage
{
get
{
return strTheMessage;
}
set
{
strTheMessage = value;
}
}
protected override void CreateChildControls()
{
base.CreateChildControls();
LiteralControl lc = new LiteralControl(MyMessage);
Controls.Add(lc);
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.Write(MyMessage);
}
}
}
以上是关于csharp 具有一个可自定义属性的简单SharePoint WebPart示例的主要内容,如果未能解决你的问题,请参考以下文章