zoukankan      html  css  js  c++  java
  • DEV express 对Gridview某行的元素赋值

    1:获取选中的行某列的值

    string colValue= this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, this.gridView1.Columns[1]).ToString() ;

    gridview.GetFocusedRowCellValue("字段 的值")
    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();

    转换成模型对象可以单独操作每一行单据数据

    ModelClass Model= vCurrenRow as ModelClass ;

    Model.aa="cc";

    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();

  • 相关阅读:
    juicer 语法
    mvc 理解
    php 之 trait
    阿里P8面试官:如何设计一个扛住千万级并发的架构?
    建模
    镜像推送时出现 server gave HTTP response to HTTPS client 问题的解决方法
    git在线练习网站
    ubuntu 20.04 LTS 更换阿里云源
    Proxmox VE(Proxmox Virtual Environment)制作优盘(U盘)启动盘的教程说明方法
    KubeSphere部署Nacos集群
  • 原文地址:https://www.cnblogs.com/yibinboy/p/5612216.html
Copyright © 2011-2022 走看看