This is a migrated thread and some comments may be shown as answers.

Add new row disappears

13 Answers 335 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lovsten
Top achievements
Rank 1
Lovsten asked on 29 Aug 2007, 01:36 PM
Just purchased RadControls for Winforms and is starting to use it.

I have a problem with the addnewrow functionality.

Im connected the GridView to a collection of one of my business objects.
It loads just fine. I can edit a value just fine.
I got Allownewrow=true so the "Click here to add new row" shows.
When I enter values here and then change row I can debug that the new object is inserted into my collection, but it does not show any more in GridView. If I do an Update, which saves my collection to DB the object is there and gets saved. If I reload the collection the new row is there.

But I want the user to see new rows added without having to save it. What am I doing wrong?

13 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 29 Aug 2007, 04:26 PM
Hi Lovsten,

The problem you experience is that the data source does not notify the grid of the changes. Here is how it works:
  1. The grid adds the new record in the data source.
  2. The data source notifies the grid for the changes that have occurred
  3. The grid refreshes with the new changes applied
To be able to use that, your data source needs to implement the IBindingList interface. This way every change in the data source (no matter if it is made by the grid or by external source) will be reflected in the grid.

Instead of implementing all methods of the IBindingList interface, you can inherit the BindingList class that has default implementation of the above mentioned interface.
 

Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lovsten
Top achievements
Rank 1
answered on 30 Aug 2007, 06:24 AM
Hi

My collection (Suppliers) does implement the IBindingList interface.
Any other ideas?

Our class structure looks like this:

Public Class Suppliers

Inherits BusinessCollectionBase

***

Public MustInherit Class BusinessCollectionBase

Inherits SortableCollectionBase

***

Public Class SortableCollectionBase

Inherits BindableCollectionBase

****

public abstract class BindableCollectionBase : CollectionBase, IBindingList


 

0
Dwight
Telerik team
answered on 30 Aug 2007, 02:36 PM
Hello Magnus,

We found an issue in the data layer which causes the problem you experience. In our upcoming release in the middle of September, it will be fixed.

As a workaround you can set the grid's datasource to null, then set your datasource again.

 
Greetings,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lovsten
Top achievements
Rank 1
answered on 31 Aug 2007, 06:48 AM
In which event do you recommend me doing this reset of datasource?
0
Lovsten
Top achievements
Rank 1
answered on 04 Sep 2007, 06:22 AM
I have not got a response on the last question.

And also, when I try to reinit the datasource as you say, it seems like the values I enter disappear and the new row get the values for the last row before I added a row = I end up with to rows with the same values. What am I doing wrong?
0
Dwight
Telerik team
answered on 04 Sep 2007, 06:52 AM
Hello Magnus,

We are sorry for the delayed answer.

Our research shows that the changes (the newly added data) are not pushed back to the BindingList data source. This is an issue we have to fix.

Again, we apologize for the inconvenience and the delays this issue is causing.
 

Kind regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lovsten
Top achievements
Rank 1
answered on 04 Sep 2007, 07:30 AM
Fair enough. I wait eagerly on the new release then.

But I need to get something working in the meantime. I was thinking of just removing your add new row (AllowAddNew=false) and handle this myself from a contextmenu.

Tried 2 things (and none worked)
1. .rows.add(values)
2. Mycollection.Add(new MyObject)

How should I do this?? I need a temp workaround
0
Jack
Telerik team
answered on 04 Sep 2007, 04:16 PM
Hello Lovsten,

The Q2 beta will be published tomorrow and it will contain fixes for your issue. For now we can offer you to manually update the grid data. This can be done using MasterGridViewInfo.UpdateView function. Use this code:

this.radGridView1.MasterGridView.UpdateView(false);

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lovsten
Top achievements
Rank 1
answered on 05 Sep 2007, 12:56 PM
Could not get that to work either so I just wait for the beta. Where can I download it from when it's been published?
0
Jack
Telerik team
answered on 06 Sep 2007, 08:20 AM
Hello Lovsten,

It is our pleasure to announce the long awaited beta of RadControls for WinForms Q2 2007. Here is a link to the official announcement: http://www.telerik.com/community/forums/thread/b311D-htmdd.aspx

In case you need the Dev version of the beta, please open a support ticket and we will send you the link.


Greetings,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lovsten
Top achievements
Rank 1
answered on 06 Sep 2007, 10:28 AM
I'm now using the Q2 beta. These are my results:

First time I click on add new row adn enters new values, the row still disappears.
Second time I do this, it work just fine.
Third and onwards, adds a new row but it's always added with the values from the second time.
0
Jack
Telerik team
answered on 06 Sep 2007, 11:45 AM
Now, this is strange. As much as I hate to say this, I am not sure where the problem is. I discussed your case with the rest of the RadGridView developers and they have no clues where the problem could be either. The only way to find what is wrong is to review your application.

WIll it be possible to open a support ticket and send us a sample application with your business objects? This way we will be able to investigate the issue. Thank you for your cooperation.
 

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lovsten
Top achievements
Rank 1
answered on 06 Sep 2007, 12:03 PM
Support ticket now opened
Tags
GridView
Asked by
Lovsten
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Lovsten
Top achievements
Rank 1
Jack
Telerik team
Share this question
or