コード例 #1
0
 private void DropDownCheckBoxListDataSouceBind(DataTable dt)
 {
     DropDownCheckBoxList1.DataTextField  = "DisplayName";
     DropDownCheckBoxList1.DataValueField = "Roles";
     DropDownCheckBoxList1.DataSource     = dt;
     DropDownCheckBoxList1.DataBind();
 }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null || Session["UserName"].ToString().Equals(""))
        {
            Response.Write("<script>window.open('../loginnew.aspx','_top')</script>");
            return;
        }
        if (!IsPostBack)  // 页面首次加载
        {
            //初始化
            publicProject.Visible   = false;
            ViewState["myFilename"] = "";
            MySqlConnection mysqlcon = msq.getmysqlcon();
            DataSet         ds       = MySqlHelper.ExecuteDataset(mysqlcon, str111);
            DataView        dv       = new DataView(ds.Tables[0]);
            //DropDownList1.AppendDataBoundItems = true;
            //DropDownList1.DataSource = dv;
            //DropDownList1.DataTextField = "benfactorFrom";
            //DropDownList1.DataBind();
            DropDownCheckBoxList1.DataSource    = dv;
            DropDownCheckBoxList1.DataTextField = "benfactorFrom";
            DropDownCheckBoxList1.DataBind();
            DropDownCheckBoxList1.Visible = false;

            if (Session["userRole"].ToString() == "1")
            {//分会权限
                CheckBox1.Visible             = false;
                DropDownList1.SelectedValue   = "选择机构";
                DropDownList1.Enabled         = false;
                DropDownCheckBoxList1.Visible = true;
            }
            if (Request.QueryString.Count > 0)//如果是从审批未通过跳转过来的
            {
                infoTitle.Text = "项目:" + Request["title"].Trim() + " 审批未通过";
                //DropDownList1.SelectedValue = Request["branchName"].Trim();
                DropDownList1.SelectedValue   = "选择机构";
                DropDownList1.Enabled         = false;
                DropDownCheckBoxList1.Visible = true;
                //DropDownCheckBoxList1.SelectedValue = Request["branchName"].Trim();
                DropDownCheckBoxList1.SelectedText = Request["branchName"].Trim();
                //DropDownCheckBoxList1.SelectedItem.Value = Request["branchName"].Trim();
                //DropDownCheckBoxList1.SelectedValueAndText = Request["branchName"].Trim();
                //DropDownCheckBoxList1.SelectedItem.Text = Request["branchName"].Trim();
                DropDownCheckBoxList1.Enabled = false;
            }
        }
    }