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

Telerik RadGridView for Silverlight with MVVM

0 Answers 120 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.
Spoorthy
Top achievements
Rank 1
Spoorthy asked on 25 Feb 2012, 08:37 PM
Hi ,

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.
Tags
GridView
Asked by
Spoorthy
Top achievements
Rank 1
Share this question
or