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

Example of Using with GridView for Editing ?

5 Answers 402 Views
EntityFrameworkDataSource
This is a migrated thread and some comments may be shown as answers.
Thilo
Top achievements
Rank 1
Iron
Thilo asked on 18 Jul 2012, 08:14 PM
Hello !
Is there any example of Using RadEntityFrameworkDataSource with RadGridView for Editing ?
I Want to Insert and Edit Rows and Save this to the Database.
In My Testproject i Have an Entity Model with Name 'TestDB' it Only have one Entity 'Adresse' With Fields ID, Name, Street, ZIP, Town
My Code now looks like this: (There is only Xaml Code, no Code Behind or other Classes):
I Can Insert Rows with the Insert Button.
The Save Button is Enabled after Editing, after Clicking it, it goes Disabled, but no Changes are saved to the Database.
<Window x:Class="RadControlsEFTest.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:local="clr-namespace:RadControlsEFTest"
                Title="MainWindow" Height="500" Width="800" WindowStartupLocation="CenterScreen">
        <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
      <telerik:RadEntityFrameworkDataSource Name="AdressDataSource" QueryName="Adresse">
      <telerik:RadEntityFrameworkDataSource.ObjectContext>
        <local:TestDBEntities/>
      </telerik:RadEntityFrameworkDataSource.ObjectContext>
    </telerik:RadEntityFrameworkDataSource>
    <StackPanel Orientation="Horizontal" Background="LightBlue">
      <telerik:RadButton Content="Save" Width="70" Margin="5" Command="telerik:RadGridViewCommands.CommitEdit" CommandTarget="{Binding ElementName=RadGridView}" />
      <telerik:RadButton Content="Insert" Width="70" Margin="5" Command="telerik:RadGridViewCommands.BeginInsert" CommandTarget="{Binding ElementName=RadGridView}" />
    </StackPanel>
    <telerik:RadGridView Name="RadGridView" Grid.Row="1" ItemsSource="{Binding DataView, ElementName=AdressDataSource}"/>
        </Grid>
</Window>

5 Answers, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 19 Jul 2012, 07:30 AM
Hi Thilo,

An example for RadEntityFrameworkDataSource can be found on our demos. If you have local installation of RadControls for WPF, you can open Examples_CS.sln and check the full source code of the demo.

Let us know if you have additional questions.
 
Kind regards,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Eric
Top achievements
Rank 1
answered on 01 Nov 2012, 07:02 PM
The example does not include adds.
0
Vlad
Telerik team
answered on 02 Nov 2012, 07:29 AM
Hello,

 Actually the example support full CRUD operations including add, remove and update. Just press INSERT key on your keyboard to add items in RadGridView.

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Eric
Top achievements
Rank 1
answered on 02 Nov 2012, 03:39 PM
Thanks for the tip!

However, there is no way I would have figured that out on my own, can you please improve the documentation for this control?

Eric
0
Vlad
Telerik team
answered on 05 Nov 2012, 06:45 AM
Hi,

 You may need to check this article for more info:
http://www.telerik.com/help/wpf/gridview-managing-data-add-new-entries.html

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
EntityFrameworkDataSource
Asked by
Thilo
Top achievements
Rank 1
Iron
Answers by
Yordanka
Telerik team
Eric
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or