C#.Net PageBase/MasterPageBase
using System;
using System.Data;
using DBconnector.DB;
using System.Web;
using System.Configuration;
using System.Text;
using System.Data.Common;
using System.Web.UI;
namespace Pub.Class {
public partial class PageBase : Page {
protected string skin = "default";
protected string title = string.Empty;
protected string description = string.Empty;
protected string keywords = string.Empty;
protected int index = 0;
protected StringBuilder js = new StringBuilder();
protected StringBuilder css = new StringBuilder();
public string Skin { get { return skin; } set { skin = value; } }
public string Title { get { return title; } set { description = value + ", "; keywords = value + ", "; title = value + " - "; } }
public string Description { get { return description; } set { description = value.Length > 0 ? value + ", " : value; } }
public string Keywords { get { return keywords; } set { keywords = value.Length > 0 ? value + ", " : value; } }
public int Index { get { return index; } set { index = value; } }
public string JS { get { return js.ToString(); } set { value.Split(';').Do((s, i) => { js.AppendFormat("<script language=\"JavaScript\" type=\"text/javascript\" src=\"{0}\"></script>", s); }); } }
public string CSS { get { return css.ToString(); } set { value.Split(';').Do((s, i) => { js.AppendFormat("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}\" />", s); }); } }
}
}
using System;
using System.Data;
using DBconnector.DB;
using System.Web;
using System.Configuration;
using System.Text;
using System.Data.Common;
using System.Web.UI;
namespace Pub.Class {
public partial class MasterPageBase : MasterPage {
protected string skin = "default";
protected string title = string.Empty;
protected string description = string.Empty;
protected string keywords = string.Empty;
protected int index = 0;
protected StringBuilder js = new StringBuilder();
protected StringBuilder css = new StringBuilder();
public string Skin { get { return skin; } set { skin = value; } }
public string Title { get { return title; } set { description = value + ", "; keywords = value + ", "; title = value + " - "; } }
public string Description { get { return description; } set { description = value.Length > 0 ? value + ", " : value; } }
public string Keywords { get { return keywords; } set { keywords = value.Length > 0 ? value + ", " : value; } }
public int Index { get { return index; } set { index = value; } }
public string JS { get { return js.ToString(); } set { value.Split(';').Do((s, i) => { js.AppendFormat("<script language=\"JavaScript\" type=\"text/javascript\" src=\"{0}\"></script>", s); }); } }
public string CSS { get { return css.ToString(); } set { value.Split(';').Do((s, i) => { js.AppendFormat("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}\" />", s); }); } }
}
}
开源:
https://github.com/hcxiong 欢迎收藏:)