I want to insert data into database using the button control in RowDetailsTemplate of radgridview in mvvm.
My View:
<
telerik:RadGridView Grid.Row="4" x:Name="gdLoad" ItemsSource="{Binding TotalBaseMetalsInfo}"
AutoGenerateColumns="False" RowStyleSelector="{StaticResource rowStyleSelector}"
ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Visible" ShowGroupPanel="False"
CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" ShowInsertRow="True">
<telerik:RadGridView.Columns>
<telerik:GridViewToggleRowDetailsColumn/>
<telerik:GridViewDataColumn Header="User Name" DataMemberBinding="{Binding UserName}" />
<telerik:GridViewDataColumn Header="Salary" DataMemberBinding="{Binding Salary}" />
<telerik:GridViewDataColumn Header="Department" DataMemberBinding="{Binding DeptName}" />
</telerik:RadGridView.Columns>
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<Grid Width="1000" HorizontalAlignment="Left">
<
TextBox Name="tstUserName" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="7" Text="{Binding UserName, Mode=TwoWay}"></TextBox>
<TextBox Name="tstSalary" Grid.Row="2" Grid.Column="1" Text="{Binding Salary, Mode=TwoWay}" Grid.ColumnSpan="7"></TextBox>
<TextBox Name="tstDeptName" Grid.Row="4" Grid.Column="2" Text="{Binding DeptName, Mode=TwoWay}" Grid.ColumnSpan="3"></TextBox>
<Button x:Name="btnAdd" Content="Add" Command="{Binding CalculateCommand}" Grid.Row="6" Grid.Column="0" Click="btnAdd_Click"></Button>
</Grid>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
</telerik:RadGridView>
The Problem :
While inserting my ViewModel properties are converted to null values instead of the values typed in the UI textboxes.For this,the database is inserted with null values in all the fields.
Please help me out to insert data on button click of RowDetailsTemplate of RadGridView using mvvm
Thanks in advance
Spoorthy.