您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->MyWebPages51aspx汉化最终版>>App-Code/Controls/SectionControlBaseClass.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:MyWebPages51aspx汉化最终版
普通视图
		            
1//=============================================================================================== 2// 3// (c) Copyright Microsoft Corporation. 4// This source is subject to the Microsoft Permissive License. 5// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 6// All other rights reserved. 7// 8//=============================================================================================== 9 10using System; 11using System.Web.UI; 12using System.Web.UI.WebControls; 13using System.Web.UI.HtmlControls; 14 15namespace MyWebPagesStarterKit.Controls 16{ 17 public abstract class SectionControlBaseClass : UserControl 18 { 19 /// <summary> 20 /// Indicates whether a section control 21 /// </summary> 22 public abstract bool HasAdminView 23 { 24 get; 25 } 26 public abstract string InfoUrl 27 { 28 get; 29 } 30 public abstract ISection Section 31 { 32 set; 33 get; 34 } 35 36 public ViewMode ViewMode 37 { 38 get 39 { 40 object o = ViewState["ViewMode"]; 41 if (o != null) 42 return (ViewMode)o; 43 else 44 return ViewMode.Readonly; 45 } 46 set 47 { 48 ViewState["ViewMode"] = value; 49 } 50 } 51 52 53 # region Section Rss Methods 54 public bool RssCapable(Type t) 55 { 56 return (typeof(ISidebarObject).IsAssignableFrom(t)); 57 } 58 59 /// <summary> 60 /// Renders an RSS button to display at the end of the control 61 /// </summary> 62 /// <param name="page"></param> 63 protected void DisplayRssButton(WebPage page) 64 { 65 if (Request.QueryString["pg"] != null && WebSite.GetInstance().EnableSectionRss) 66 { 67 HyperLink lnkRss = new HyperLink(); 68 Image img = new Image(); 69 img.Width = Unit.Pixel(1); 70 img.ImageUrl = ResolveUrl("~/Images/spacer.gif"); 71 img.Height = Unit.Pixel(20); 72 73 lnkRss.NavigateUrl = ResolveUrl("~/SectionRss.ashx?psid=" + Sidebar.CreatePageSectionKey(Section.SectionId, page.PageId)); 74 lnkRss.ImageUrl = ResolveUrl("~/Images/rss.gif"); 75 lnkRss.ToolTip = "Rss"; 76 lnkRss.Text = "Rss"; 77 Controls.AddAt(Controls.Count, lnkRss); 78 Controls.AddAt(Controls.Count, img); 79 80 } 81 } 82 83 /// <summary> 84 /// header-tag for rss detection in the browswer 85 /// </summary> 86 /// <param name="page"></param> 87 /// <returns></returns> 88 protected HtmlLink MetaLink(WebPage page) 89 { 90 HtmlLink link = new HtmlLink(); 91 string sURL = "http://" + Request.Url.Authority + ResolveUrl("~/SectionRss.ashx?psid=" + Sidebar.CreatePageSectionKey(Section.SectionId, page.PageId)); 92 link.Attributes.Add("rel", "alternate"); 93 link.Attributes.Add("type", "application/rss+xml"); 94 link.Attributes.Add("title", page.Title + ": " + Section.GetType().Name.ToString()); 95 link.Attributes.Add("href", sURL); 96 return link; 97 } 98 #endregion 99 100 } 101}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:MyWebPages51aspx汉化最终版
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号