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.

Accessing value and celltype of nested table

Thread ID:

Created:

Updated:

Platform:

Replies:

74630 Jun 23,2008 12:59 PM Jun 25,2008 08:52 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 23, 2008 12:59 PM

Hello,

I am using a grid grouping control that contains nested tables. I'm looking for a way to access specific cells of the sub table outside of the querycellstyleinfo event.

Here is my grid setup:

I have to source tables Customer and Location.
Customer is the main table, and Location is the sub table.
Customer has a customerID field, Location contains customerId, locationDescription, and address.
They are related by a customerID in both tables.
Address is a dropdown field.

//Set Data source to dataset because grid displays a multiple table hierarchy
//set datamember to top level table
customerGrid.DataSource = customerDataSet;
customerGrid.DataMember = "Customer";

//set up relation between the Customer and Location tables
GridRelationDescriptor rdCustomerToLocation = new GridRelationDescriptor();
rdCustomerToLocation.Name = "rdCustomerToLocation";
rdCustomerToLocation.RelationKind = RelationKind.RelatedMasterDetails;
rdCustomerToLocation.ChildTableName = "Location"; //Link to Location table

//link tables on level column values
rdCustomerToLocation.RelationKeys.Add("customerID", "customerID");

//set columns to be visible in child table
rdCustomerToLocation.ChildTableDescriptor.VisibleColumns.Add("locationDescription");
rdCustomerToLocation.ChildTableDescriptor.VisibleColumns.Add("address");

//Add the relation to the Customer table descriptior
customerGrid.TableDescriptor.Relations.Add(rdCustomerToLocation);

//add relation to Locations table to Customers table
customerGrid.TableDescriptor.Relations.Add(rdCustomerToLocation);

If I wanted to for example change the dropdown datasource of the adress field of customer 42, location description Alberta outside of an event how would I do that?
Is there a way to uniquily identify a specific cell in a nested table in the grid, like an index I can use?
I was able to access the cells in the main Customer table, but not the nested Location table.


Sri Rajan [Syncfusion]
Replied On June 25, 2008 08:52 AM

Hi Nikesh,

Thank you for your interest in Syncfusion products.

You need to handle TableControlCurrentCellShowingDropDown event to change the datasource of the combobox(in Parent and child table) dynamically. Please refer the below code.

void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
if (cr != null)
{
((GridComboBoxListBoxPart)cr.ListBoxPart).DataSource = list2;
}
}


If you want to change the datasource of the child table dynamically based on the value of another cell. Then that can be achieved through QueryCellInfo.

Please refer the below forum:
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=102

Please let me know if this helps.

Best Regards,
Srirajan


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.

;