1. Bind ilist
Aspxgridview1.keyfieldname = "ID"; // specify the primary key. Directly update data and bind the sub-table
Aspxgridview1.datasource = List; // specify the data of the grid.
Aspxgridview1.databind (); // execute binding
Right-click the gridview and choose columns ..." You can open the column Setting Dialog Box to set attributes such as the column title and fieldname. The new column is gridviewdatatextcolumn by default. When adding or modifying a column, edit it in a text box. Select change to in the toolbar to change the column type. You can change the editing method when adding or modifying a column.
Data Display-related attributes
Aspxgridview1. settingsbehavior. allowfocusedrow = true the highlighted row aspxgridview1.settingspager
Pagesize: the amount of data displayed on each page. If the data has been loaded, change it immediately after modification.
The text of the allbutton. Text "show all data" button
Allbutton. Visible: whether to display the "show all data" button
Firstpagebuotton/lastpagebutton/nextpagebutton/prevpagebutton/Corresponds to the home page, last page, next page, and previous page. The settings are the same as above.
Does seofriendly enable search engine optimization?
The format of the page summary information specified by summary.
2. Bind a Master/Slave table (ilist)
The list element has the list attribute (category. Products) and needs to be displayed in the form of Grid Nesting.
1. Select the gridview (gird1), right-click the menu and choose "Edit template"-"detailrow". The detailed data page is displayed, and a new aspxgridview (grid2) is added to the detailrow to display detailed data, you can set columns attributes of grid2. Grid2.settingsdetail. isdetailgrid = true specify grid2 as the slave table data table.
2. added the grid2 databinding event.
Code
Protected void grid2_databinding (Object sender, eventargs E)
{
Devexpress. Web. aspxgridview. aspxgridview grid = sender as devexpress. Web. aspxgridview. aspxgridview;
If (grid! = NULL) & (dict! = NULL ))
{
Int I = (INT) grid. getmasterrowkeyvalue ();/* Get the key recorded in the master table. keyfieldname must be set for the master table grid */
If (I> = 0)
{
Grid. datasource = dict [I]. Products; // locate the data using the key, which is the data source of the child table.
}
}
}
3. Right-click detailrow and select "End template editing ". Modify grid1.settingsdetail attributes
Bool allowonlyonemasterrowexpanded defaults to false. whether to allow only one row of the primary table to expand. When the second line of detailed records is expanded after true, the last expanded detailed records are closed.
Whether the bool showdetailbutton displays the details button. True: displays a "+" line at the beginning.
Bool showdetailrow true displays detailed data
3. Export aspxgridview data
Add an aspxgridviewexporter control to the page and set gridviewid to the grid for data export. Call the following method to export the data.
Aspxgridviewexporter1.writexlstoresponse
Aspxgridviewexporter1.writecvstoresponse
Aspxgridviewexporter1.writeappstoresponse
Aspxgridviewexporter1.writertftoresponse
4. filter data
Method 1: Expand the Filter list next to the column title to filter data (similar to the Excel Filter Method) grid. settings. showheaderfilterbutton = true; the Filter list lists all the data in the column. You can also customize the contents of the filter list, for usage see: http://demos.devexpress.com/ASPxGridViewDemos/Filtering/HeaderFilter.aspx
Method 2: display the field filter condition input box grid. settings. showfilterrow = true in the column header; display the condition judgment mode drop-down list grid. settings. showfilterrowmenu = true;
5. Custom Column Display
Grid. settingcustomizationwindow
Enabled running custom Column Display
Popuphorizontalalign horizontal align
Popupverticalalign vertical align
Open the column editing box in JavaScript.
Code
<SCRIPT type = "text/JavaScript">
<% -- change button title -- %>
function updatecustomizationwindowvalue () {
var element = document. getelementbyid ("btncustwindow");
If (element = NULL) return;
element. value = (grid. iscustomizationwindowvisible ()? "Hide": "show") + "customization window";
}< br> <% -- display the Custom column editing window -- %>
function showhidecustomizationwindow () {
If (grid. iscustomizationwindowvisible ()
grid. hidecustomizationwindow ();
else grid. showcustomizationwindow ();
updatecustomizationwindowvalue ();
}< br>
<Dxwgv: aspxgridview id = "gird" ......>
................................
<Clientsideevents customizationwindowcloseup = "function (s, e) {updatecustomizationwindowvalue ();}"/>
</Dxwgv: aspxgridview>
6. edit data in Grid
If the keyfieldname of aspxgridview is specified, you can add, delete, and modify a column of commandcolumn in columns. Commandcolumn can be set to link, image, or button. Modify the attribute grid. settingsediting. mode to edit the data. To edit ilist data, you must set objectdatasouce,CodeSee http://www.devexpress.com/Support/Center/e/E38.aspx
The effect of each mode value is as follows: