コード例 #1
0
    //设置页面信息
    private void BindData()
    {
        if (Request["id"] != null)
        {
            string zcid = Request["id"].ToString();
            U_ZCBU zc1  = new U_ZCBU();

            DataSet ds    = zc1.GetZCSSInfo(zcid);
            string  user1 = zc1.GetZerenByZCID(zcid);
            zc1.Close();
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < arr1.Length; i++)
                {
                    Util.SetControlValue(this.sszt.Parent.FindControl(arr1[i]), ds.Tables[0].Rows[0][arr1[i]]);
                    Util.SetControlValue(this.sszt.Parent.FindControl(arr1[i] + "_1"), ds.Tables[0].Rows[0][arr1[i]]);
                }
            }
            ds.Dispose();


            //设置按钮的权限
            if (user1 == User.Identity.Name || (user1.Trim() == "" && PubComm.IsRole("系统管理员")))
            {
                this.Button1.Visible = true;

                for (int i = 0; i < arr1.Length; i++)
                {
                    if (this.sszl.Parent.FindControl(arr1[i] + "_1") != null)
                    {
                        this.sszl.Parent.FindControl(arr1[i] + "_1").Visible = false;
                    }
                }
            }
            else
            {
                this.Button1.Visible = false;

                for (int i = 0; i < arr1.Length; i++)
                {
                    if (this.sszl.Parent.FindControl(arr1[i]) != null)
                    {
                        this.sszl.Parent.FindControl(arr1[i]).Visible = false;
                    }
                }
            }
        }
    }