zoukankan      html  css  js  c++  java
  • C# dataGricview 加选择框

      DataGridViewCheckBoxColumn columncb = new DataGridViewCheckBoxColumn();
                columncb.HeaderText = "选择";
                columncb.Width = 50;
                columncb.Name = "cb_check";
                columncb.TrueValue = true;
                columncb.FalseValue = false;
                //column9.DataPropertyName = "IsScienceNature";
                columncb.DataPropertyName = "IsChecked";
                grdData.Columns.Add(columncb);    

         

            private void SetAllRowChecked()
            {
                // DataGridCell cel=(sender as DataGridCell).
                int count = Convert.ToInt16(this.grdData.Rows.Count.ToString());
                for (int i = 0; i < count; i++)
                {
                    DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)grdData.Rows[i].Cells["cb_check"];
                    Boolean flag = Convert.ToBoolean(checkCell.Value);
                    if (flag == false) //查找被选择的数据行
                    {
                        checkCell.Value = true;
                    }
                continue;
                }
            }

    君子性非异也,善假于物也!
  • 相关阅读:
    js 获取时间差
    linq 两个list合并处理,并分组
    单例模式 双锁
    2018年的读书清单
    感悟
    asp.net使用Microsoft.mshtml提取网页标题等解析网页
    //利用反射快速给Model实体赋值
    C# url接口调用
    多字段动态查询
    对图片的操作
  • 原文地址:https://www.cnblogs.com/zhaoCat/p/5819320.html
Copyright © 2011-2022 走看看