public string ls_listcolumn = "SBMCPYM,ZJFFBM,USERID,CZRQ,KPSFSC"; public bool lb_state = false; //控制显示标志 protected void CheckBox1_OnCheckedChanged(object sender, EventArgs e) { this.HiddenField1.Value = ls_listcolumn; if (this.CheckBox1.Checked == true) { lb_state = true; } else { lb_state = false; } BindData(); } //显示或隐藏列 //控制是否显示列 if (this.HiddenField1.Value != null) { ls_listcolumn = this.HiddenField1.Value; String[] fldArr = new string[6]; fldArr = ls_listcolumn.Split(new Char[] { ',' }); //分割列名到表头 for (int i = 0; i 0) { gridView.Columns[GetColumnIndex(gridView, ls_columnname)].Visible = lb_state; } } } //通过列名得到列的索引值 public int GetColumnIndex(GridView gridView, string fieldName) { int index = -1; for (int i = 0; i
详细解决方案
列暗藏或显示
热度:59 发布时间:2012-10-09 10:21:45.0
public string ls_listcolumn = "SBMCPYM,ZJFFBM,USERID,CZRQ,KPSFSC"; public bool lb_state = false; //控制显示标志 protected void CheckBox1_OnCheckedChanged(object sender, EventArgs e) { this.HiddenField1.Value = ls_listcolumn; if (this.CheckBox1.Checked == true) { lb_state = true; } else { lb_state = false; } BindData(); } //显示或隐藏列 //控制是否显示列 if (this.HiddenField1.Value != null) { ls_listcolumn = this.HiddenField1.Value; String[] fldArr = new string[6]; fldArr = ls_listcolumn.Split(new Char[] { ',' }); //分割列名到表头 for (int i = 0; i 0) { gridView.Columns[GetColumnIndex(gridView, ls_columnname)].Visible = lb_state; } } } //通过列名得到列的索引值 public int GetColumnIndex(GridView gridView, string fieldName) { int index = -1; for (int i = 0; i
相关解决方案