App_Code/Controls/SidebarControl.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================

using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.Xsl;

namespace MyWebPagesStarterKit.Controls
{
    /// <summary>
    /// Sidebar control to display a vertical bar with various RSS items/channels
    /// </summary>
    public class SidebarControl : WebControl, INamingContainer
    {
        /// <summary>
        /// Reference to sidebar data object
        /// </summary>
        protected Sidebar _sidebar;

        /// <summary>
        /// Constructor, initializes sidebar data
        /// </summary>
        public SidebarControl(): base()
	    {
            _sidebar = Sidebar.GetInstance();
	    }

        /// <summary>
        /// Adds controls to the sidebar depending on the Sidebar data object
        /// </summary>
        protected override void CreateChildControls()
        {
            string Xml = _sidebar.GetRSSFeed(HttpContext.Current.User.Identity);

            if (Xml != string.Empty)
            {
                //for Valid XHTML 1.0 Transitional the div-tag cannot be placed directly within span-tag
                //span-tag is created automatically by the .net control
                HtmlGenericControl obj = new HtmlGenericControl("object");
                Controls.Add(obj);

                HtmlGenericControl divTop = new HtmlGenericControl("div");
                divTop.Attributes.Add("class", "sidebartop");
                //Controls.Add(divTop);
                obj.Controls.Add(divTop);
                
                HtmlGenericControl divSidebar = new HtmlGenericControl("div");
                divSidebar.Attributes.Add("class", "sidebar");
                //Controls.Add(divSidebar);
                obj.Controls.Add(divSidebar);
后面还有 28 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。