categorydisplay.cs

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 69 行

CS
69
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.WebControls;

using CommunityServer.Blogs.Components;
using CommunityServer.Components;

namespace CommunityServer.Blogs.Controls
{
    /// <summary>
    /// Summary description for CategoryDisplay.
    /// </summary>
    public class CategoryDisplay : WeblogThemedControl
    {
        public CategoryDisplay()
        {
		
        }

        /// <summary>
        /// Attaches controls need to display category data
        /// </summary>
        protected override void AttachChildControls()
        {
            Literal title = FindControl( "Title" ) as Literal;
            Literal body = FindControl( "body" ) as Literal;
            HyperLink rss = FindControl( "rss" ) as HyperLink;

            int CategoryID = 0;
            if(Context.Request.QueryString["CategoryID"] != null)
            {
                double cid = 0;
                if(Double.TryParse( Context.Request.QueryString["CategoryID"], System.Globalization.NumberStyles.Integer, null, out cid ))
                    CategoryID = (int)cid;
            }

            if(CategoryID >=0)
            {
                CategoryType ct = (CategoryType)Enum.Parse(typeof(CategoryType),Context.Request.QueryString["CT"],true);
                PostCategory pc = PostCategories.GetCategory(CategoryID,ct,this.CurrentWeblog.SectionID,false);
                if(pc != null)
                {
                    if(title != null)
                        title.Text = pc.Name;
                    
                    if(body != null)
                        body.Text = pc.Description;

                    if(rss != null)
                    {
                        rss.Visible = ct == CategoryType.BlogPost;
                        if(rss.Visible)
                            rss.NavigateUrl = BlogUrls.Instance().Rss(this.CurrentWeblog.ApplicationKey,CategoryID);
                    }

                    this.SetPageTitle(pc.Name);
                }

            }
        }

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?