We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programatically Navigating a Grid Grouping Countrol

Thread ID:

Created:

Updated:

Platform:

Replies:

48542 Aug 30,2006 12:49 PM UTC Sep 1,2006 07:13 AM UTC WinForms 3
loading
Tags: GridControl
Bill Langlais
Asked On August 30, 2006 12:49 PM UTC

Hi,

I have a Grid Grouping Control bound to 5 DataTables which are nested from level 1 though 5. The data in the grid is also displayed in tab control graphically where there is a tab for each row at the third level and the data at the 4th and 5th level are drawn on the tab page.

I want to be able to programatlically position the correct rows in the grouping grid, expanding where necessary, so that a user can select something in a particular tab page and have the coresponding row at either the 4 or 5 level positioned and selected so the user can see the coresponding data.

I have two questions:

How do I locate data in the grid using the data in the DataTable regardless of how the user may have sorted the rows at a particular level.

How do I position and select the apropriate rows in the grid so that they are visable.

Thanks for your help

WJL

Administrator [Syncfusion]
Replied On August 31, 2006 07:07 AM UTC

Hi Bill,

Issue 1:

Use the SortedColumns property in GridTableDescriptor to sort the table in a grid. Below is a code snippet

GridTableDescriptor gd = this.gridGroupingControl1.GetTableDescriptor("ChildTable");
if( !gd.SortedColumns.Contains("childID") )
gd.SortedColumns.Add("childID",ListSortDirection.Descending);

Issue 2:

To make a record as SelectedRecord, you can call the SelectedRecords.Add method. Here is a code snippet,

GridTable gt = this.gridGroupingControl1.GetTable("ChildTable");
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;

//Add the record to the selection.....
gt.SelectedRecords.Add(gt.Records[0]);

To set the record as current record, you need to call the SetCurrent() method.
gt.Records[0].SetCurrent();

Let me know if this helps.
Best Regards,
Haneef

Bill Langlais
Replied On August 31, 2006 12:20 PM UTC

Hi,

Thanks for your response.

On Issue 1:

I want to find a record in the grid programatically without effecting the way the grid is sorted or apears to the user so that I can highlight it in issue 2.


>Hi Bill,

Issue 1:

Use the SortedColumns property in GridTableDescriptor to sort the table in a grid. Below is a code snippet

GridTableDescriptor gd = this.gridGroupingControl1.GetTableDescriptor("ChildTable");
if( !gd.SortedColumns.Contains("childID") )
gd.SortedColumns.Add("childID",ListSortDirection.Descending);

Issue 2:

To make a record as SelectedRecord, you can call the SelectedRecords.Add method. Here is a code snippet,

GridTable gt = this.gridGroupingControl1.GetTable("ChildTable");
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;

//Add the record to the selection.....
gt.SelectedRecords.Add(gt.Records[0]);

To set the record as current record, you need to call the SetCurrent() method.
gt.Records[0].SetCurrent();

Let me know if this helps.
Best Regards,
Haneef

Administrator [Syncfusion]
Replied On September 1, 2006 07:13 AM UTC

Hi Bill,

Sorry for the inconvenience caused.

To find the record index, you can use the IndexOf method in UnsortedRecords collection. Below is a code snippet

int unsortedIndex = this.gridGroupingControl1.Table.UnsortedRecords.IndexOf(record);

int sortedIndex = this.gridGroupingControl1.Table.Records.IndexOf(record);

Thanks,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;