zoukankan      html  css  js  c++  java
  • DEV控件

    1、设置Gridview控件的某列是否可编辑(CUser:数据库字段)

    this.gdv.Columns["CUser"].OptionsColumn.AllowEdit = false;

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

    或者this.gdv.OptionsBehavior.Editable = false;

    3、设置Gridview控件,是否排序(gdv:控件名称)

    this.gdv.OptionsCustomization.AllowSort = false;

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

    this.gdv.FocusedRowHandle = -1

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

    int index= this.gdv.GetFocusedDataSourceRowIndex() ;

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

    6、获取选中Gridview的行数据

    DataRow dr= this.gdv.GetFocusedDataRow();

    7、删除选中Gridview行数据

    this.gdv.DeleteRow(this.gdv.FocusedRowHandle);

    8、调整列宽

    //自动调整所有字段宽度
    this.gridView1.BestFitColumns();
    //调整某列字段宽度
    this.gridView1.Columns[n].BestFit();

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

    int[] iRowId = this.gdv.GetSelectedRows();

    List<int> rows = this.GetSelectRows(gdv);

  • 相关阅读:
    ShellExecuteEx 函数说明
    npm
    Byte和char
    如何高效阅读一个项目
    C++中慎用malloc
    #ifdef
    string
    C++与C混合编译
    git@github.com: Permission denied (publickey).
    connect to host github.com port 22: Connection refused
  • 原文地址:https://www.cnblogs.com/longyong007/p/12567660.html
Copyright © 2011-2022 走看看