母模版:
C#代码: public partial class MasterPage : System.Web.UI.MasterPage{ public int UserId { get { return 342; } } public string UserName = "shenjk"; protected void Page_Load(object sender, EventArgs e) { }}
在页面中获取该值:
C#代码: protected void Page_Load(object sender, EventArgs e) { PropertyInfo pl = this.Master.GetType().GetProperty("UserId"); object o = pl.GetValue(this.Master, null); //o=342 FieldInfo f = this.Master.GetType().GetField("UserName"); object o1 = f.GetValue(this.Master); //o1=shenjk }转载于:https://www.cnblogs.com/J2EEPLUS/archive/2010/03/16/2487937.html
相关资源:基于同步辐射光刻工艺和电铸工艺的金属纳米光栅模具制备