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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridTableModel Bug?

Thread ID:

Created:

Updated:

Platform:

Replies:

33579 Aug 23,2005 08:44 AM UTC Aug 23,2005 10:20 AM UTC WinForms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 23, 2005 08:44 AM UTC

Hi together, I have a gridgroupingcontrol which is bound to a dataset object consisting of four tables. Now when I want to get the TableMode of a specific table I use the following code: GridTableModel model = gridGroupingControl1.GetTableModel("A"); Everything seems fine, but when I try to get the GroupingControl property like this: GridGroupingControl actCtrl = model.GroupingControl I get a null reference. But the DataSet is already bound to the grid. Any ideas? Cheers, Markus

Administrator [Syncfusion]
Replied On August 23, 2005 09:16 AM UTC

Here is the code that defines this property in our library.
public GridGroupingControl GroupingControl
{
	get
	{
		Control c = this.ActiveGridView;
		while (c != null)
		{
			if (c is GridGroupingControl)
				return (GridGroupingControl) c;
			c = c.Parent;
		}

		return null;
	}
}
As you see, it is a dynamically set property that will return return null when there is no ActiveGridView associated with the GridTableModel. (In general, the only TableModel with such an active grid view is the parent one, this.grid.TableModel). So, if you need to look up the GroupingControl based on a child GridTableModel, you could use a Hashtable that you set up yourself. But you cannot rely on the tableModel.GroupingControl property.

Administrator [Syncfusion]
Replied On August 23, 2005 09:17 AM UTC

Hi I think that you might not have created a new GirdGroupingControl using the following code. So add the code and then check. GridTableModel model = gridGroupingControl1.GetTableModel("A"); //Code to be added. GridGroupingControl actCtrl = new GridGroupingControl(); actCtrl = model.GroupingControl;

Administrator [Syncfusion]
Replied On August 23, 2005 09:55 AM UTC

This has no influence - actCtrl is still a null reference. >Hi > > I think that you might not have created a new GirdGroupingControl using the following code. >So add the code and then check. > >GridTableModel model = gridGroupingControl1.GetTableModel("A"); > >//Code to be added. >GridGroupingControl actCtrl = new GridGroupingControl(); > > actCtrl = model.GroupingControl;

Administrator [Syncfusion]
Replied On August 23, 2005 10:20 AM UTC

That is to be expected. As the only TableModel that has an active view is this.gridGroupingControl1.TableModel. Check this.gridGroupingControl1.TableModel.GroupingControl and I think you will see it is not null. But any tablemodel you get by calling GetTableModel passing any string other than this.gridGroupingControl1.TableModel.Table.TableDescriptor.Name will return null. So, if you want to access the GridGroupingControl from child table models, then you will have to handle this yourself, say using a hashtable as suggested above.

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

;