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. Image for the cookie policy date
close icon

Updating data tables with relations

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?


6 Replies

AD Administrator Syncfusion Team February 14, 2007 01:04 AM UTC

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


AD Administrator Syncfusion Team February 15, 2007 11:28 AM UTC

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!


AD Administrator Syncfusion Team February 15, 2007 08:18 PM UTC

Hi George,

Please try the below code snippet.

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

Best regards,
Haneef


AD Administrator Syncfusion Team February 16, 2007 05:15 PM UTC

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.


AD Administrator Syncfusion Team February 16, 2007 08:16 PM UTC

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


AD Administrator Syncfusion Team February 22, 2007 08:44 PM UTC

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?

Loader.
Live Chat Icon For mobile
Up arrow icon