
i need to update my gridview programmatically but nothing i have tried is working. thats my scenario:
i have a grid with several different columns (combobox-, textbox-, checkbox-column), some of them can be edited, some of them are calculated and can't be edited by user. one row is representing one object, the grid is bound via itemsource.
the following process has to be implemented now:
1. user changes the value of an editable field
2. cell_validating-event is fired
3. in the cell_validating-event, the input is first verified. if the inserted value is okay, 3 other values are generated (bound to 3 non-editable columns)
4. after assigning the new values the grid needs to be updated (generated values should show up).
everything is working till step 4. i have tried to assign a new itemsource and call rebind, i have checked on the bindings, but nothing is working. if i load the page containing the grid a second time my data is showing up, but it need to be there directly after the validation! any suggestions?
8 Answers, 1 is accepted
Do your data items implement INotifyPropertyChanged?
Regards,Yavor Georgiev
the Telerik team

No it doesn't, but I like to avoid the INotifyPropertyChanged interface. Is there any other thing i can do?
Thx in advance
The INotifyPropertyChanged interface is the corner-stone of effortless data binding in the WPF and Silverlight worlds. I strongly recommend that you revise your opinion of it.
Could you please try call Rebind() only, without touching the ItemsSource. Do please note that calling Rebind() every time a cell is changed is a performance hit.
I still strongly advocate using INotifyPropertyChanged.
Yavor Georgiev
the Telerik team

It would help us immensely in tracking down the issue if you'd open a support ticket and attach a small sample application that reproduces this issue. I would be very grateful if you do so.
Sincerely yours,Yavor Georgiev
the Telerik team

i have added my sample to a bug report. hope that helps solving this problem because i really need a solution for this until the end of this week. please let me know if you have any futher suggestions.

I have the same problem (Rebind not working).
To explain the things - I work with Linq2Sql - which is (unfortunately) not fully supported by RadGrid.
So I have to do a lot in code behind.
Anyhow - I found a nice support sample so this was not to hard - from the first point of view.
About the problem:
In the RowEditEnded I take care about inserts like this:
ImportDirectory iD = e.EditedItem as ImportDirectory;
if(e.EditOperationType == GridViewEditOperationType.Insert) {
m_dC.ImportDirectories.InsertOnSubmit(iD);
m_dC.SubmitChanges();
rgvDirectories.Rebind();
So I changed to this (from the support code):
m_dC.ImportDirectories.InsertOnSubmit(iD);
m_dC.SubmitChanges();
m_dC.Refresh(System.Data.Linq.RefreshMode.KeepChanges, m_dC.ImportDirectories);
rgvDirectories.Rebind();
So I solve it "brute force":
m_dC.ImportDirectories.InsertOnSubmit(iD);
m_dC.SubmitChanges();
rgvDirectories.ItemsSource = null;
//m_dC.Refresh(System.Data.Linq.RefreshMode.KeepChanges, m_dC.ImportDirectories);
rgvDirectories.ItemsSource = m_dC.ImportDirectories;
Instead I "undbind" the Grid - which shows some (handled) "Argument Exceptions" in debug.
And bind it again - that works!
A final interesting thing - for delete Rebind works:
m_dC.ImportDirectories.DeleteOnSubmit(iD);
m_dC.SubmitChanges();
//rgvDirectories.ItemsSource = null;
//m_dC.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, m_dC.ImportDirectories);
//rgvDirectories.ItemsSource = m_dC.ImportDirectories;
rgvDirectories.Rebind();
I know that Linq2Sql is missing Observable.... - but I thought Grid.Rebind() should overcome this problem.
But it does the job only partial (in delete) - for insert only "brute force" works.
That's why I aske here since Monika seems to have a similar problem.
My hope is that here support ticket resulted in a solution.
Manfred
Why not use a bit more different approach - for example MVVM. I've made for you small example application to illustrate you how to achieve your goal with LINQ to SQL - you can find the project attached. In the previous case rebind didn't worked since it was called during Validating event which is not correct.
All the best,Vlad
the Telerik team