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.
Unfortunately, activation email could not send to your email. Please try again.

Updating data tables with relations

Thread ID:

Created:

Updated:

Platform:

Replies:

56303 Feb 13,2007 07:46 AM Feb 22,2007 03:44 PM Windows Forms 6
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On February 13, 2007 07:46 AM

In the ManualRelations example, I have tried to update the data tables with new values by clicking on a button to reload the values.

I have not re-instantiated the datatables, but instead cleared all data rows and repopulated with new data.

Unfortunately, this causes the relationships between the parent, child and grandchild tables to stop working. If I click on a row in the parent table, the child table does not update any longer.

Can you please advise?


Administrator [Syncfusion]
Replied On February 13, 2007 08:04 PM

Hi George,

Please refer to the following forum thread for more details.
< a rel='nofollow' href="http://www.syncfusion.com/support/forums/message.aspx?MessageID=54942">http://www.syncfusion.com/support/forums/message.aspx?MessageID=54942

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 15, 2007 06:28 AM

Hello

Thanks for your response.

Can you please advise how I can select the first row in the Child table when it is loaded with data. I am able to select the first row in the parent table using

if (myDataTable.Rows.Count > 0)
{
Table.Records[0].SetCurrent();
}

but in the child GGC, the datasource is actually the parent's datasource. The GridTable returned by this.Table gives the parent datatable.

Is there a way to get the child datatable?

Thanks!

Administrator [Syncfusion]
Replied On February 15, 2007 03:18 PM

Hi George,

Please try the below code snippet.

GridTable table = this.gridGroupingControl1.GetTable("ChildTableName");
table.Records[0].SetCurrent();

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 16, 2007 12:15 PM

Hi,

Thanks again, the solution worked.

Going back to my first query, the example you put a link for is for a databoundgrid whereas i am using a gridgroupingcontrol. Can you please show me how to only show certain columns of the related table where the tables are gridgroupingcontrols?

Thanks very much.

Administrator [Syncfusion]
Replied On February 16, 2007 03:16 PM

Hi George,

You can use the VisibleColumns collection property to remove/add/move the column from the grid. Here is a code snippet that shows you "How to remove the columns from the nested table in grid?".

GridRelationDescriptor parentToChildRelationDescriptor = this.gridGroupingControl1.TableDescriptor.Relations["ParentChildRelation"];
parentToChildRelationDescriptor.ChildTableDescriptor.VisibleColumns.Remove("OrderName");
this.gridGroupingControl1.Refresh();

Please refer to the attached sample for implementation.
CollectionWithRelatedMasterGrouping.zip

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 22, 2007 03:44 PM

Hi

Thanks again.

Another issue I am having is that I have two grids. The second grid has several rows, and for each row, there is a column (PRICE) that updates its values constantly (like the trading application demo).

I would like to select the row with a cell value of "PRIM" in the formula column, and then take the value in the PRICE cell and display it in the first grid on the appropriate row, in an unbound/design time added column. This must then update the value constantly aswell to match the second grid.

I have managed to do the following:

this.gridGroupingControl1.TableDescriptor.Columns.Add("PrimPrice");
GridColumnDescriptor d1 = this.gridGroupingControl1.TableDescriptor.Columns["PrimPrice"];
DataView dv = new DataView(this.gridGroupingControl2.DataTable);
dv.RowFilter = string.Format("[Formula] = '{0}'", "PRIM");
d1.Appearance.AnyRecordFieldCell.DataSource = dv;
d1.Appearance.AnyRecordFieldCell.DisplayMember = "Price";
d1.Appearance.AnyRecordFieldCell.ValueMember = "SpotPrice";
d1.AllowBlink = true;

This fails to show the value.

However, if i change the cell type to a combo box, using d1.Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox;

When i click the drop down button, the prim price value appears in the list and also updates accordingly. Can you please explain why i cannot use a standard call type and how i can overcome this issue?

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.

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.

;