zoukankan      html  css  js  c++  java
  • DEV控件的Gridview小技巧总结

    1、设置Gridview控件的某列不可编辑

    this.gridData.gridView1.Columns["change_date"].OptionsColumn.AllowEdit = false;

    字段:change_date是数据库中字段,是绑定到gridview上的。

    2、设置Gridview控件整体不可编辑

    this.gridData.IsEnableEdit = false;

    3、设置Gridview控件,列头不可排序

    this.gridDataDetail.gridView1.OptionsCustomization.AllowSort = false;

    4、使Gridview控件,失去选中焦点

    this.gridData.gridView1.FocusedRowHandle = -1

    5、判断Gridview是否选中了数据

    int index= this.gridData.gridView1.GetFocusedDataSourceRowIndex() ;

    如果index小于0,证明没有选中行,否则就选中了行数据

    6、获取选中Gridview的行数据

    DataRow vCurrenRow = this.gridData.gridView1.GetFocusedDataRow();

    7、删除选中Gridview行数据

    this.gridDataDetail.gridView1.DeleteRow(this.gridDataDetail.gridView1.FocusedRowHandle);

    8、Gridview新增一条编辑行

    DataRow vDetailRow = this.DataDetailSourceTable.Rows.Add(); //这是新增加了一行 vDetailRow["primary_key"] = ""; primary_key为数据库绑定到Gridview中的字段,后面可以对其进行赋值。

    9、获取GridView中所有的选中的行号

    int[] iRowId = this.gridData.gridView1.GetSelectedRows();

  • 相关阅读:
    php 邮件发送开发前期配置
    抛弃传统的curl,使用Guzzle
    TP5.1 分页(带参数传递)
    tp5.1 模型 where多条件查询 like 查询
    xpath 和 jsonpath 解析
    python分布式爬虫框架 --- scrapy-redis
    python爬虫框架——scrapy
    python爬虫 --- urllib
    mysql事务和锁
    mysql数据储存
  • 原文地址:https://www.cnblogs.com/jara/p/3363428.html
Copyright © 2011-2022 走看看