If I click the "Click here to add new item" row in my gridview, a new row appears as expected. However, as soon as I click anywhere other than on the new row (triggering RowEditEnded), the new row disappears from the gridview and the "Click here to add new item" row replaces it.
If I then save changes, the invisible row DOES save to the database and re-appears after a refresh. In other words, while the row disappears visually from the grid, it still exists in the datasource the grid binds to and is valid enough to save.
If I repeat the actions in the first paragraph 10 times and then save changes, 10 invisible rows will save to the database and reappear after a refresh.
What is going on here???
The gridview::
The bound data source:
If I then save changes, the invisible row DOES save to the database and re-appears after a refresh. In other words, while the row disappears visually from the grid, it still exists in the datasource the grid binds to and is valid enough to save.
If I repeat the actions in the first paragraph 10 times and then save changes, 10 invisible rows will save to the database and reappear after a refresh.
What is going on here???
The gridview::
<
telerik:RadGridView
x:Name
=
"LoanGrid"
ItemsSource
=
"{Binding Loans}"
IsBusy
=
"{Binding AreLoansBusy}"
CanUserSelect
=
"{Binding CanUserSelectLoans}"
SelectedItem
=
"{Binding SelectedLoan, Mode=TwoWay}"
Margin
=
"10,-6,10,10"
GroupRenderMode
=
"Flat"
IsReadOnly
=
"{Binding UserHasProjectRole, Converter={StaticResource NegationConverter}}"
ColumnWidth
=
"*"
CanUserInsertRows
=
"{Binding UserHasProjectRole}"
SelectionMode
=
"Single"
NewRowPosition
=
"Bottom"
AutoGenerateColumns
=
"False"
IsSynchronizedWithCurrentItem
=
"True"
ShowGroupPanel
=
"False"
IsFilteringAllowed
=
"False"
ValidatesOnDataErrors
=
"InEditMode"
ActionOnLostFocus
=
"CommitEdit"
Grid.Row
=
"0"
Grid.Column
=
"0"
Grid.ColumnSpan
=
"2"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewComboBoxColumn
Header
=
"Loan Type"
IsReadOnly
=
"False"
DataMemberBinding
=
"{Binding LoanTypeId}"
SelectedValueMemberPath
=
"Id"
DisplayMemberPath
=
"Description"
ItemsSource
=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.LoanTypes}"
Width
=
"Auto"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"ApplicationAmount"
Header
=
"Application Amount"
DataMemberBinding
=
"{Binding ApplicationAmount, StringFormat=c2}"
TextAlignment
=
"Right"
Width
=
"Auto"
/>
<
telerik:GridViewDataColumn
Header
=
"Total Project Costs"
DataMemberBinding
=
"{Binding TotalProjectCosts, StringFormat=c2}"
TextAlignment
=
"Right"
Width
=
"Auto"
/>
<
telerik:GridViewDataColumn
Header
=
"Eligible Project Costs"
DataMemberBinding
=
"{Binding EligibleProjectCosts, StringFormat=c2}"
TextAlignment
=
"Right"
Width
=
"Auto"
/>
<
telerik:GridViewDataColumn
Header
=
"Interest Rate"
DataMemberBinding
=
"{Binding InterestRate, StringFormat='{}{0}%'}"
TextAlignment
=
"Right"
Width
=
"Auto"
/>
<
telerik:GridViewDataColumn
Header
=
"Indenture"
DataMemberBinding
=
"{Binding Indenture}"
Width
=
"Auto"
/>
<
telerik:GridViewDataColumn
Header
=
"EFC Bond Series"
DataMemberBinding
=
"{Binding EfcBondSeries}"
Width
=
"Auto"
/>
<
telerik:GridViewDataColumn
Header
=
"Auditing"
IsReadOnly
=
"True"
Width
=
"Auto"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding LastUpdatedBy}"
/>
<
TextBlock
Text
=
"{Binding LastUpdatedDate, StringFormat=g}"
Margin
=
"5 0 0 0"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"RowEditEnded"
>
<
infrastructure:InvokeDelegateCommandAction
Command
=
"{Binding LoanRowEditEndedCommand}"
CommandParameter
=
"{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"
/>
</
i:EventTrigger
>
<
i:EventTrigger
EventName
=
"Deleting"
>
<
infrastructure:InvokeDelegateCommandAction
Command
=
"{Binding LoanRowDeletingCommand}"
CommandParameter
=
"{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"
/>
</
i:EventTrigger
>
<
i:EventTrigger
EventName
=
"RowValidating"
>
<
infrastructure:InvokeDelegateCommandAction
Command
=
"{Binding LoanRowValidatingCommand}"
CommandParameter
=
"{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>
</
telerik:RadGridView
>
The bound data source:
public
QueryableDataServiceCollectionView<ProjectPhaseLoan> Loans {
get
;
private
set
; }