DEV express assigns a value to the element of a row in the Gridview, devgridview

Source: Internet
Author: User

DEV express assigns a value to the element of a row in the Gridview, devgridview

1: Get the value of a column in the selected row

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

Gridview. GetFocusedRowCellValue ("field value ")


Dev gridview tips

1. Set a column in the Gridview control to be uneditable.

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

Field: change_date is a field in the database and is bound to the gridview.

2. Set the Gridview control to make it uneditable.

This. gridData. IsEnableEdit = false;

3. Set the Gridview control and the column headers cannot be sorted.

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


4. Make the Gridview Control lose the selected focus

This. gridData. gridView1.FocusedRowHandle =-1

5. Check whether data is selected in the Gridview.

Int index = this. gridData. gridview1.getfocused#cerowindex ();

If the index is smaller than 0, it indicates that no row is selected. Otherwise, the row data is selected.

6. Obtain the row data of the selected Gridview

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

To convert a model object, you can operate on each line of document data separately.

ModelClass Model = vCurrenRow as ModelClass;

Model. aa = "cc ";

7. Delete the selected row of data in the Gridview.

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

8. Add an edit row in the Gridview.

DataRow vDetailRow = this. DataDetailSourceTable. Rows. Add (); // this is a new row.
VDetailRow ["primary_key"] = ""; primary_key is the field bound to the Gridview by the database, which can be assigned a value later.

9. obtain all the selected row numbers in the GridView.

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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.