Adding new with rowdetails raddataform

3 posts, 1 answers
  1. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 30 Nov 2016 Link to this post

    Hi,

    I have a gridview that I have marked as readonly because I *only* want the user to be able to edit/add data via my rowdetails editor. According to the doc if I have the gridview marked as readonly they can't add a new row. I'm stuck. I need a way to add a row and have the user enter the new info via the rowdetails datattemplated editor. Any ideas?

     

    Thanks ... Ed

     

  2. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1171 posts

    Posted 01 Dec 2016 Link to this post

    Hello Ed,

    Although you cannot add new records through RadGridView's UI or with the BeginInsert method when the grid is read-only, you can use its Items collection's AddNewItem method to add an item and select it if needed.

    private void Button1_Click(object sender, RoutedEventArgs e)
    {
        var item = new Club() { Name = "Asd" };
        this.clubsGrid.Items.AddNewItem(item);
        this.clubsGrid.SelectedItem = item;
    }

    Please let me know whether such an approach would work for you.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
  3. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 01 Dec 2016 Link to this post

    That'll work!

    Thanks.

     

Back to Top