XtraGrid usage experience (fold-over main sub-files, group statistics), xtragrid usage experience

Source: Internet
Author: User

XtraGrid usage experience (fold-over main sub-files, group statistics), xtragrid usage experience

The key classes of XtraGrid are GridControl and GridView. GridControl itself does not display data, and the data is displayed in the GridView/CardView/XXXXView. GridControl is a container for various views. To control the display, you must start with the GridView classes. I will not talk about the relationship between GridControl and GridView. The following code is provided. It is often used in actual use.

Public Form2 ()
// Do not display the built-in navigation bar.
// Panel with no group displayed
// Automatically change the line Content
// Allows automatic merge of cells
// If the contents of the slave table are not found in the master-slave table, the table is displayed (not displayed by default)
// Display the automatically filtered rows (the effect is similar to that of the automatically filtered rows in Excel)
// Make the GridView uneditable
// Built-in editor Display Mode
// Whether the display function of the Master/Slave table is available
// If the Master/Slave table is displayed, A Tabs is displayed with a plus sign each time. Two panels are usually displayed.

 

Private void btnExit_Click (object sender, EventArgs e)
}

Private void btnOk_Click (object sender, EventArgs e)
DataSet ds = new DataSet ();
// Data of the Child GridView
// This is the key to displaying Master/Slave tables. 1. GridControl analyzes data by checking the content of DataSet. Relations.
// This is also the key. It cannot be set to ds directly. The table must be specified.
 

The above code shows a master-slave table. Tips for displaying Master/Slave tables. The document has not been mentioned yet. I tried it for one night. As shown above, it is actually very simple.

The preceding DbHelperSQL was developed from CodeMatic 2.0 and I modified it myself.

The code above is as follows:

For the GridView, I have two major questions:

1. The Master/Slave table is displayed.

Ii. Grouping display, which is frequently used in reports. The GridView solution is simple and you only need to set the GroupIndex attribute of the corresponding column. ========================================================== ========================================================== =======================Add a row number to the GridView of XtraGrid. The sample code is as follows: // set the width of the row indicator (the row indicator is the column in the leftmost column that does not display anything)
// Add a group statistics field
// Set the display format of grouping statistics fields
// Set the grouping Field
// Open all Groups
// Draw borders for controls
// Focus cell column
// The row number of the row where the focus cell is located
// Focus cell value
// Specify the string value displayed in the cell
// Specify the cell value
// Set the value of the specified column in the row where the focus cell is located
// Set the focus cell value
// Set the value of the specified Cell
// Add a new row
// The method with RowCount-1 is not good
// Automatically generates columns Based on the bound Data Source
// Add a drop-down list for the column (add other types such as date and UpDown)
// Ri. PopupWidth = 200;
Ri. DisplayMember = "SC _prna ";
Ri. ValueMember = "SC _prno ";
DataTable dt1 = DbHelperSQL. QueryT ("select SC _prno, SC _prna from mespb04h ");
Ri. DataSource = dt1;
Gv1.Columns ["SC _prno"]. ColumnEdit = ri;

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.