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.
Syncfusion Feedback

GDBG reverse AddRelation function.

Thread ID:

Created:

Updated:

Platform:

Replies:

93847 Apr 7,2010 05:16 PM Jul 19,2010 05:35 AM Windows Forms 9
loading
Tags: GridControl
Alex Feldman
Asked On April 7, 2010 05:16 PM

Salute,
I'm using WinForms Syncfusion GDBG v.7.302.0.20

1. In order to support hierarchical data model (in my case 2 level nested BindingList) I use
aGrid.Binder.AddRelation("Nested");
How I could gracefully remove that relation?
I have tried
ResetHierarchyLevels();
Is that correct? Is there another way?

2. Is that right statement that I could only AddRelation and populate the columns when DataSource has been already assigned? The weird issue I am seeing is that after I add relation and assign GridBoundColumns on the second level the grid displays empty cells. The issue appearing only when DataSource contains more than couple of hundred records otherwise the code works.

Jisha Joy [Syncfusion]
Replied On April 8, 2010 04:47 AM

Hi Alex,

Thank you for posting query to us.

If you are getting this behavior while rebinding the GridDataBoundGrid, then please use the following code to rebind the GridDataBoundGrid and let me know if this helps.

this.gridDataBoundGrid1.BeginUpdate();
this.gridDataBoundGrid1.DataSource = null;
this.gridDataBoundGrid1.DataMember = null;
this.gridDataBoundGrid1.Binder.ResetHierarchyLevels();
this.gridDataBoundGrid1.Binder.InternalColumns.Clear();
this.gridDataBoundGrid1.DataSource = ds;
this.gridDataBoundGrid1.DataMember = "ParentTable";
this.gridDataBoundGrid1.EndUpdate();

Regards,
Jisha

Alex Feldman
Replied On April 8, 2010 08:56 AM

Thank you for quick response, unfortunately the solution didn't help for the second issue described.

I would like to confirm again the sequence.

1. Prepare grid before binding:
aGrid.BeginUpdate();
aGrid.DataSource = null;
aGrid.DataMember = null;
aGrid.Binder.ResetHierarchyLevels();
aGrid.Binder.InternalColumns.Clear();

aGrid.GridBoundColumns = columns;
[Changing the cells width and hieght, setting header and frozen columns and rows]

where columns are created dynamically and belong to the first level.

2. Assign aGrid.DataSource = aList
where aList is IBindingList

3. Create second level column model:
GridHierarchyLevel level = aGrid.Binder.AddRelation("Nested");
if (level != null)
{
var columns = (GridBoundColumnsCollection)aGrid.Binder.InternalColumns.Clone();
level.GridBoundColumns = columns;
level.ShowHeaders = false;
}

What I see
after setting DataSource Grid display values for fraction of a second.
Than (after second level and relation is created) grid is empty.
Grid Lines are still displayed (I can check that CurrencyManager contain not empty List) The values in the grid are not displayed.

I'm working on example. But please investigate some more.



Alex Feldman
Replied On April 9, 2010 03:54 PM

I could not reproduce the issue in sample application.

Although I find the reason for grid to display empty cells.
PropertyDescriptor property on each GridBoundColumn become null upon the next line of code:
level.GridBoundColumns = aColumns;
where level is GridHierarchyLevel

The immediate solution would be to call gdbView.Binder.InitializeColumns();

Could you give more information about why GridBoundColumns on root level are reset? And is there clean solution?

Jisha Joy [Syncfusion]
Replied On April 12, 2010 02:07 AM

Hi Alex,

Please refer the samples under the following category from our browser sample that demonstrates the hierarchy in GridDataBoundGrid.

..\Grid.Windows\Samples\2.0\Data Bound\Hierarchy\

Regards,
Jisha

Alex Feldman
Replied On July 12, 2010 10:52 AM

I'm using GridDataBoundGrid Syncfusion 7.4, C# .NET 2.0, Vista OS, VS2008.
In the example I have attached, the idea is that clicking button1, button2, button3 would switch grid between different bound columns. The issue if user would hide columns they would not reappearing again ?!

It looks like columns "cached" somewhere inside grid structures and not recreated again. Could you please let me how switching grid columns suppose to be used? Or maybe point out in code how to fix it. The code was recreated from bigger project so cached collection of columns is created, part where grid layout is save/load is cut out.

Thank you.



columncreation_647c5597.zip

Jisha Joy [Syncfusion]
Replied On July 13, 2010 01:53 AM

Hi Alex,

I am afraid I was not able to understand the query clearly. If you are mentioning about the hided column are not reappearing when switch grid between different bound columns, then I have tried the following steps.

1. Run the sample

2. Press 'Button1' and hide some columns

3. Press 'Button2; . Then all columns come in view.

Please let me know the reporducing steps to see the issue here?.


Regards,
Jisha

Alex Feldman
Replied On July 13, 2010 07:54 AM

I will prepare another example.
The issue I am describing is the following:
1. Click button1, button2, button3. It will create all 3 different collection of columns. Clicking again would use those collection (clone them) and assign back to grid.
2. Manually hide some columns in let say first set (the first column is a1). Notice that you only hide columns in first set, second and third are not touch.
3. Switch to 2nd set by clicking button2, why columns hidden in set 1 are not vissible in set2?

Alex Feldman
Replied On July 13, 2010 11:42 AM

You could find modified project in the attached file.

1. Click "Button1", "Button2", "Button3".
2. Click "Button4" - it'll hide some of the columns.
3. Click "Button1", "Button2" - (columns remain hidden)

Question. I was looking for solution to restore the columns.

While testing/waiting/investigating I have installed 8.2 version to check the example. It looks like in my test application it works as desired/expected.
Please confirm that issue exists in v 7.4 for .NET 2.0.

Thank you.



columncreation2_92501bc5.zip

Jisha Joy [Syncfusion]
Replied On July 19, 2010 05:35 AM

Hi Alex,

I could able to see the issue with 7.4.0.20. But issue is no more existing with v8.2. Please make use of our latest version.

Regards,
Jisha


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

;