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

Hierarchical child grid not refresh after programmatically add new row

3 Answers 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
CQT
Top achievements
Rank 1
CQT asked on 13 Nov 2013, 03:17 PM

Hello, I have a problem with a Hierarchical GridView.
Both my father grid and child one have dataset as datasource.
When I'm going to add a new row in child gridview i should populate the fields with a value taken from a textbox.
To populate cells of the new row I used the sub SubGrids_AddingNewDataItem or SubGrids_BeginningEdit to assign values to each cell.
The process seems to work, I can see the new added row but i can't see assigned values of each gridview cells immediatly, I have to click 2 times over each cell to see the values.
Once the new row is added to my gridview i don't see any value even if the item contains the value in code behind. The second time I enter the cell I can see the value I set in code behind.
I need your help to know how to add a new row in my child gridview, setting values from code behind and get them immediately visible when creating new row process ends.


Best Regards

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 18 Nov 2013, 02:01 PM
Hi,

Would you please try assigning values for the newly added row like this:

void MainWindow_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
 {
     e.NewObject = new Player("Name 1", 6, Position.DF, "Spain");
 }
 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
CQT
Top achievements
Rank 1
answered on 19 Nov 2013, 09:39 AM
Hy Didie,
I tried your solution but the application gives me this error: "Unable to add external objects to the list" after I assign the value to e.NewObject.
Did you have any suggestion to solve this problem?

Thanks.
0
Dimitrina
Telerik team
answered on 19 Nov 2013, 11:42 AM
Hi,

I am not able to reproduce such an error.
Is your details GridView bound to a collection of Player objects? If so, then may I ask you to isolate the issue a demo project and send it to us?

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
CQT
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
CQT
Top achievements
Rank 1
Share this question
or