Dev GridControl common properties of GridView,

Source: Internet
Author: User

Dev GridControl common properties of GridView,

1. Hide the top GroupPanel:

GridView1.OptionsView. ShowGroupPanel = false;

2. Obtain the value of a field in the selected record:

SValue = Table. Rows [gridView1.FocusedRowHandle] [FieldName]. ToString ();

3. data read-only:

GridView1.OptionsBehavior. Editable = false;

4. MasterDetailView not displayed:

GridView1.OptionsDetail. EnableMasterViewMode = false;

5. Modify the top GroupPanel content:

GridView1.GroupPanelText = "Running ing ";

6. Set the Data source:

GridControl1.DataSource = dt;

7. read/write copy permission settings:

Read-Only files cannot be copied:

ColumnViewOptionsBehavior. Editable = False

Read-only and copyable:

ColumnViewOptionsBehavior. Editable = True

OptionsColumn. AllowEdit = True

OptionsColumn. ReadOnly = True

Editable:

ColumnViewOptionsBehavior. Editable = True

OptionsColumn. AllowEdit = True

OptionsColumn. ReadOnly = False

8. settings of the template column:

In Columns, find ColumnEdit in its attributes.

Taking LookUpEdit as an example:

First, add LookUpEdit from the menu In-Place Editor Repository on the left of Designer. name Re1. then. add three Columns to the Columns attribute. caption is sequential: number, name, and gender. fieldnames are FID, FNAME, and FSEX in sequence. set NullText of Re1 to null.

AutoSearchColumnIndex attribute is set to 2. ImmediatePopup attribute is set to True.

Set SearchMode to OnlyInPopup.

Then, attach this template column to column 1 as mentioned above (that is, set ColumnEdit attribute of Column 1 to Re1)

Finally, we need to bind the data source and display item to Re1 in the code.

Re1.DataSource = DALUse. Query ("select fid, fname, fsex from dual"). Tables [0];

Re1.DisplayMember = "FSEX ";

Re1.ValueMember = "FNAME ";

9. Set a column of text and title to be displayed:

GridView1.Columns [0]. AppearanceHeader. TextOptions. HAlignment = DevExpress. Utils. horzarignment. Center;

GridView1.Columns [0]. AppearanceCell. TextOptions. HAlignment = DevExpress. Utils. horzarignment. Center;

10. Remove the automatic filtering function (Filter) on a column ):

GridView1.Columns [0]. OptionsFilter. AllowAutoFilter = false;

GridView1.Columns [0]. OptionsFilter. AllowFilter = false;

GridView1.Columns [0]. OptionsFilter. ImmediateUpdateAutoFilter = false;

11. Set freeze columns (left frozen ):

GridView1.Columns [0]. Fixed = DevExpress. XtraGrid. Columns. FixedStyle. Left;

12. Get the cell data (0 rows and 0 columns ):

String ss = gridView1.GetRowCellDisplayText (0, gridView1.Columns [0]);

String ss = gridView1.GetRowCellValue (0, gridView1.Columns [0]);

13. Set cell data:

GridView1.SetRowCellValue (0, gridView1.Columns [0], "123 ");

14. To set the automatically added row number, add the mdrawrowindicator event to the gridview first.

Private void gridview_CustomDrawRowIndicator (object sender, DevExpress. XtraGrid. Views. Grid. RowIndicatorCustomDrawEventArgs e)

{

If (e. Info. IsRowIndicator & e. RowHandle> = 0)

E. Info. DisplayText = (e. RowHandle + 1). ToString ();

}

15. How can I disable the movement of column headers?

Set gridView1.OptionsCustomization. AllowColumnMoving = false

 

16. How can I disable the sorting of column headers?

Set gridView1.OptionsCustomization. AllowSort = false

 

17. How can I disable different column headers from changing the column width?

Set gridView1.OptionsCustomization. AllowColumnResizing = false

 

 

Content on the Internet

Related Article

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.