Ticket T958016
Visible to All Users

how to make a lower level in a grid view the main level and then drop the old mainlevel ?

created 4 years ago

I need to use PLinqServerModeSource but without creating a class for the enitity.
This is because the source of my GridView can change complete in runtime, it can show a different table/view depending on the choices of the user.
I discovered that the GridControl can use a DataView to show all data and show correct headers
But DataView is not enumerable so I cannot use it as source for the PLinqServerModeSource

But if I make a List<DataRowView> and put the first DataRowView from my datatable.DefaultView it, the gridcontrol is showing all correct but not on the main level but it created a new sublevel.
So I need to move this sublevel so it becomes the main level and then drop or hide the original main level.
How can I do that ?

If someone knows how to use the DefaultView of the DataTable without all this hassle that would be even better off course

Clipboard-File-1.png

Answers approved by DevExpress Support

created 4 years ago

To display a specific detail in the Grid, you can either load only this detail from the server or assign a detail available at your data source level as a member (property).
So, if your data source has the following structure:

C#
DataSet dataSet = new DataSet(); dataSet.Tables.Add(CustomerDataTable); dataSet.Tables.Add(PersonDataTable); DataColumn keyColumn = dataSet.Tables["Customers"].Columns["ID"]; DataColumn foreignKeyColumn = dataSet.Tables["Persons"].Columns["ID"]; dataSet.Relations.Add("CustomersPersons", keyColumn, foreignKeyColumn);

the code to display the Persons detail table can be the following:

C#
GridControl.DataSource = dataSet.Tables[""Persons""];

As for the use of PLinqServerModeSource, let's continue our discussion in your other ticket where you asked a similar question:
how to use DataTable.DefaultView as datasource for PLinqServerModeSource

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.