コード例 #1
0
    public void BindData()
    {
        string qs = DDLQs.SelectedValue;

        if (IsRoot(StartNumber, qs, Session["W_DDBH"].ToString()) == false)
        {
            string maxqs = WTreeBLL.GetMaxQS();
            string ts    = "您没有权限查看该网络图!";

            if (IsRoot(StartNumber, maxqs, Session["W_DDBH"].ToString()))
            {
                ts = "您查看的这期中没有这个会员,所以不能查看该网路!";
            }

            ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('" + ts + "');window.history.go(-1);</script>");
            return;
        }

        object[] obj = WTreeBLL.GetLLTTree_II(qs, EndNumber, StartNumber, "1", "0");

        SqlDataReader dr = (SqlDataReader)obj[0];

        while (dr.Read())
        {
            if (dr["Field"].ToString() == "PetName")
            {
                GridView1.Columns[1].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[1].Visible = false;
                }
            }

            if (dr["Field"].ToString() == "DaiShu")
            {
                GridView1.Columns[4].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[4].Visible = false;
                }
            }
            else if (dr["Field"].ToString() == "AZ")
            {
                GridView1.Columns[2].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[2].Visible = false;
                }
            }
            else if (dr["Field"].ToString() == "JiBie")
            {
                GridView1.Columns[3].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[3].Visible = false;
                }
            }
            else if (dr["Field"].ToString() == "XinGe")
            {
                GridView1.Columns[6].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[6].Visible = false;
                }
            }
            else if (dr["Field"].ToString() == "XinWang")
            {
                GridView1.Columns[7].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[7].Visible = false;
                }
            }

            else if (dr["Field"].ToString() == "XinRen")
            {
                GridView1.Columns[8].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[8].Visible = false;
                }
            }
            else if (dr["Field"].ToString() == "ZongRen")
            {
                GridView1.Columns[9].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[9].Visible = false;
                }
            }
            else if (dr["Field"].ToString() == "ZongFen")
            {
                GridView1.Columns[10].HeaderText = GetTran(dr["FieldName"].ToString());

                if (dr["IsVisible"].ToString() == "0")
                {
                    GridView1.Columns[10].Visible = false;
                }
            }
        }
        dr.Close();

        GridView1.DataSource = (DataTable)obj[1];
        GridView1.DataBind();

        SetLianLuTu(StartNumber, Session["C_L_TJ"].ToString(), qs, Session["W_DDBH"].ToString());
    }