Example of Using with GridView for Editing ?

6 posts, 0 answers
  1. Thilo
    Thilo avatar
    26 posts
    Member since:
    Feb 2011

    Posted 18 Jul 2012 Link to this post

    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>
  2. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 19 Jul 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Eric
    Eric avatar
    14 posts
    Member since:
    Jun 2012

    Posted 01 Nov 2012 Link to this post

    The example does not include adds.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 02 Nov 2012 Link to this post

    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.

  6. Eric
    Eric avatar
    14 posts
    Member since:
    Jun 2012

    Posted 02 Nov 2012 Link to this post

    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
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 05 Nov 2012 Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready