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

[Solved] Insert child object in gridview

1 Answer 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
david mcintyre
Top achievements
Rank 1
david mcintyre asked on 04 Nov 2010, 07:11 PM
<telerikGridView:RadGridView x:Name="gridPOItems" ItemsSource="{Binding ItemsDS.Data}" IsBusy="{Binding ItemsDS.IsBusy}"  AutoGenerateColumns="False" 
                                                 ColumnWidth="Auto"  CanUserFreezeColumns="False" 
                                                  CanUserReorderColumns="False" CanUserSortColumns="False" ShowGroupPanel="False" HorizontalAlignment="Left" 
                                                 CanUserDeleteRows="True" IsReadOnly="False" RowEditEnded="gridPOItems_RowEditEnded" 
                                                         IsFilteringAllowed="False" AlternationCount="2" AlternateRowBackground="{StaticResource AlternateBGBrush}" 
                                                 GridLinesVisibility="Vertical" RowIndicatorVisibility="Collapsed"
<telerikGridView:RadGridView.Columns>
<telerikGridView:GridViewDataColumn Header="{Binding ApplicationStrings.ItemName, Source={StaticResource ResourceWrapper}}" DataMemberBinding="{Binding Item.ItemName}" TextAlignment="Left" HeaderTextAlignment="Center" ShowDistinctFilters="False" IsReadOnly="True"/>                           
<telerikGridView:GridViewDataColumn Header="{Binding ApplicationStrings.POItemNote, Source={StaticResource ResourceWrapper}}" DataMemberBinding="{Binding Note.NoteText, Mode=TwoWay}" TextAlignment="Left" HeaderTextAlignment="Center" ShowDistinctFilters="False"  IsReadOnly="False"/>
</
telerikGridView:RadGridView.Columns>
</telerikGridView:RadGridView>

I am using a domaindatasource to display a list of Items in a gridview.  Each Item can have zero to 1 Note objects.  I can successfully display the Item data (not pasted in xaml) and the Note.NoteText for an existing note, and I am also able to edit existing Items and Notes.  However, i can't figure out how to insert a new Note if the Item doesn't already have one.  Whenever i enter text for a new Note, the text disappears when i am finished editing the cell.  On the server-side I am using EF and Ria Services.  I have the Includes statements in my metadata and service queries.  I also have insert and update statements for both POItem and Note. 

Is it possible to insert a child object in this situation? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 10 Nov 2010, 01:03 PM
Hi david mcintyre,

Basically, there should be no problem to insert items in the parent and child grids. You may take a look at this forum thread for further reference on the necessary settings about implementing this functionality.
Considering the case that the just-entered value in the cell disappears, I am not quite capable of making an appropriate suggestion without any additional details. Is that behavior only for the child grid - with the nodes or for the parent grid too ? Do you handle in any way the CellEditEnded event ?

All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
david mcintyre
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or