日期:2014-05-17  浏览次数:20510 次

取模板页值的问题
母版页中代码 


protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YXShop.Common.ShopUserManager.CheckShopUser();

                YXShop.Model.Member.ShopUserInfo adminInfo = (YXShop.Model.Member.ShopUserInfo)YXShop.Common.ShopUserManager.Get();
                if (adminInfo != null)
                {
                    shopid = adminInfo.ShopID;
                    shopname = adminInfo.ShopName;
                }

            }
        }

        private int shopid = 0;
        public int ShopID
        {
            set { shopid = value; }
            get { return shopid; }
        }

        private string shopname = "";
        public string ShopName
        {
            set { shopname = value; }
            get { return shopname; }
        }


内容页中代码

 protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

             }

            this.tbShopName.Text = Master.ShopName;
            this.hfShopID.Value = Master.ShopID.ToString();



但结果是 this.tbShopName.Tex=“”;this.hfShopID.Value =0

请教这是什么原因?或者应该如何处理?

谢谢

------解决方案--------------------
正常的顺序是先走内容页面的load事件然后才会走模板页面的load事件  你可以把为模板页面属性赋值的方法放在内容页面中 或者其他