📄 itembriefdescription.cs
字号:
namespace ASPNET.StarterKit.Communities {
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
//*********************************************************************
//
// ItemBriefDescription Class
//
// Represents a brief description displayed in a template
//
//*********************************************************************
public class ItemBriefDescription : WebControl {
//*********************************************************************
//
// ItemBriefDescription Constructor
//
// Assign a default css class
//
//*********************************************************************
public ItemBriefDescription() {
CssClass = "ItemBriefDescription";
EnableViewState = false;
}
//*********************************************************************
//
// OnDataBinding Method
//
// Get the brief description from the container
//
//*********************************************************************
override protected void OnDataBinding(EventArgs e) {
ContentItem item;
if (NamingContainer is ContentItem)
item = (ContentItem)NamingContainer;
else
item = (ContentItem)NamingContainer.NamingContainer;
ContentInfo objContentInfo = (ContentInfo)item.DataItem;
ViewState["BriefDescription"] = objContentInfo.BriefDescription;
}
//*********************************************************************
//
// RenderContents Method
//
// Display the brief descriptions (No HTML allowed)
//
//*********************************************************************
override protected void RenderContents(HtmlTextWriter writer) {
// we need the section for the transformations
SectionInfo objSectionInfo = (SectionInfo)Context.Items["SectionInfo"];
// display the content
writer.Write(CommunityGlobals.FormatText(AllowHtml.None, objSectionInfo.ID, (string)ViewState["BriefDescription"]));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -