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.

Only off-screen rows are updated when bound IList changes

Thread ID:

Created:

Updated:

Platform:

Replies:

63664 Jul 6,2007 01:06 PM Jul 10,2007 01:57 PM Windows Forms 12
loading
Tags: Grouping
Haishi
Asked On July 6, 2007 01:06 PM

I have a group grid that binds to a IList. When the IList changes, the rows that already displayed on the screen are not updated. However when I scroll down the list I can see that the rows that were not visible on the screen ARE updated! I tried to set TableDirty flag but that didn't help.

Haishi
Replied On July 6, 2007 01:08 PM

Forgot to mention that when I select any row that doesn't have the update, the updated field shows up. When the row is deselected the value dispears.

>I have a group grid that binds to a IList. When the IList changes, the rows that already displayed on the screen are not updated. However when I scroll down the list I can see that the rows that were not visible on the screen ARE updated! I tried to set TableDirty flag but that didn't help.

haneefm [Syncfusion]
Replied On July 6, 2007 02:59 PM

Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.

Haishi
Replied On July 6, 2007 03:35 PM

Hi Haneef:

Thank you for your suggestion but it did not solve my problem. This is my code
this.grid.EndUpdate(true);
<> this.grid.Reinitialize();
this.grid.Refresh();

But it didn't work. Also, what you said doesn't explain why I see half the rows (initially off screen) with the value but the other half (that are originally displayed on screen), and why the value appears when i select a row and dispears when the row is deselected. Btw, my class (that inherits IBindingList) does raise ListChanged event and it has been working fine with normal windows grid controls.

>Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.

Haishi
Replied On July 6, 2007 03:37 PM

Updated code:

this.grid.BeginUpdate();
//Update List Here
this.grid.EndUpdate(true);
this.grid.Reinitialize();
this.grid.Refresh();


>Hi Haneef:

Thank you for your suggestion but it did not solve my problem. This is my code
this.grid.EndUpdate(true);
<> this.grid.Reinitialize();
this.grid.Refresh();

But it didn't work. Also, what you said doesn't explain why I see half the rows (initially off screen) with the value but the other half (that are originally displayed on screen), and why the value appears when i select a row and dispears when the row is deselected. Btw, my class (that inherits IBindingList) does raise ListChanged event and it has been working fine with normal windows grid controls.

>Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.


Haishi
Replied On July 6, 2007 05:17 PM

Any more ideas? I wonder if there's some caching going on here, however I didn't find where to control the caching behaviors?


>Updated code:

this.grid.BeginUpdate();
//Update List Here
this.grid.EndUpdate(true);
this.grid.Reinitialize();
this.grid.Refresh();


>Hi Haneef:

Thank you for your suggestion but it did not solve my problem. This is my code
this.grid.EndUpdate(true);
<> this.grid.Reinitialize();
this.grid.Refresh();

But it didn't work. Also, what you said doesn't explain why I see half the rows (initially off screen) with the value but the other half (that are originally displayed on screen), and why the value appears when i select a row and dispears when the row is deselected. Btw, my class (that inherits IBindingList) does raise ListChanged event and it has been working fine with normal windows grid controls.

>Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.



haneefm [Syncfusion]
Replied On July 6, 2007 05:49 PM

Hi Stanley,

Thank you for posting your query to us.

I tried to reproduce this problem using this sample.

GGC_DataBinding.zip

But, I could not get this problem. Maybe I am not following the steps that you are doing. Is it possible for you to provide more information on this problem? This will help me to analyse the issue further.

Please do let me know if you have any technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
Haneef

Haishi
Replied On July 6, 2007 06:52 PM

Haneef:

Thank you for your sample code. To reproduce the problem, replace the line in button1_click, where you add "Stanley" record to an update like:

cc[0].FirstName = "ABC";

Then you'll see only when the first record is selected, the FirstName column shows "ABC", otherwise it shows the old value (in my case the old value is empty string).

Regards,
Stanley

>Hi Stanley,

Thank you for posting your query to us.

I tried to reproduce this problem using this sample.

GGC_DataBinding.zip

But, I could not get this problem. Maybe I am not following the steps that you are doing. Is it possible for you to provide more information on this problem? This will help me to analyse the issue further.

Please do let me know if you have any technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
Haneef

Haishi
Replied On July 6, 2007 07:09 PM

Haneef:

I removed some text to be clear

Thank you for your sample code. To reproduce the problem, replace the line in button1_click, where you add "Stanley" record to an update like:

cc[0].FirstName = "ABC";

Then you'll see only when the first record is selected, the FirstName column shows "ABC", otherwise it shows the old value (in my case the old value is empty string).

I also tried

this.gridGroupingControl1.Table.Records[0].SetValue("FirstName", "ABC");

this will solve the above problem, however there are two downsides:

1) when i update the underlying list i have no reference to which Record the list item maps to

2) this is rather strange because as the data source is "bound" to the grid i shouldn't need to do this.

Probably you have better ways that I don't know of? Thank you!

Stanley

haneefm [Syncfusion]
Replied On July 6, 2007 08:35 PM

Hi Stanley,

We have no reports of this refreshing problem, and have not seen it here. Attached video clip showing this fuctionality on my system which has 5.1 installed. Below is a video clip.

RefreshCellValuevideo.zip

Exactly what version of Windows XP are you using?

Are you only installing Essential Grid or are you installing Essential Studio? Are you installing binaries only, or the source code version?

What version of the .NET framework and VS are you using?

Did you see any errors during the installation of Essential Grid?

Best regrads
Haneef

Haishi
Replied On July 7, 2007 01:30 AM

Hmm... it does look fine in the video

I'm using XP SP2, Visual Studio 2005 Team Edition. My Syncfusion version is 5.1.0.51 binary. No error during installation.

haneefm [Syncfusion]
Replied On July 9, 2007 02:18 PM

Hi Stanley,

You can try implementing INotifyPropertyChanged interface similar to this sample:

\Grid.Grouping.Windows\Samples\2.0\CustomCollections\IBindingList

So that grid gets notified when a property in the collection’s object has been changed.

The IBindingList browser sample demonstrates the implementation of the IBindingList for the ArrayList that is used internally and also shows how to bind this list to a grouping grid control. Implementing the IBindingList will require the implementation of all the members of the IBindingList, IList, ICollection and IEnumerable interfaces.

Benefits:
The benefits of using IBindingList include the support for change notifications when the list is modified. It does have a ListChanged event which will be fired upon any data changes. If the collection supports changes, it should also support firing a ListChanged event when the collection changes. To indicate that, it should return true from the SupportsChangeNotification property. Hence when items are added or removed from the collection, the grouping grid will be notified of these chagnes and will update itself automatically.

Best regards,
Haneef

Haishi
Replied On July 10, 2007 01:57 PM

OK I found the problem. In my previous code i used wrong index when raising ListChanged event ....
Thank you for your help.

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.

;