itembriefdescription.cs
来自「C#邮件代码库,用于邮件发送」· CS 代码 · 共 76 行
CS
76 行
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 + =
减小字号Ctrl + -
显示快捷键?