Bug - adding new row radgridview

9 posts, 0 answers
  1. ronald
    ronald avatar
    54 posts
    Member since:
    Jan 2011

    Posted 27 Jan 2011 Link to this post

    Hi,

    Does anyone ever experience difficulty adding new row in the radgridview? Some of the grids I'm having difficulty clicking on the "click here to add new item". It simply does not change to the edit mode.. any ideas?

    thanks
  2. ronald
    ronald avatar
    54 posts
    Member since:
    Jan 2011

    Posted 27 Jan 2011 Link to this post

    not sure if this is a bug or not.. but it seems to be only a one way binding mode if I'm using Datatable so I needed to convert to dataview (.defaultview) to be able the radgridview adding new row.

    P.S. I have anothe application using xceed grid and it works fine with DataTable binding.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 28 Jan 2011 Link to this post

    Hi ronald,

    Using DataView is the preferred approach since DataView supports change notifications through interfaces like INotifyPropertychanged and INotifyCollectionChanged which are fundamental for WPF and enables our grid to sense data changes and respond accordingly.



    Regards,
    Milan
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  5. ronald
    ronald avatar
    54 posts
    Member since:
    Jan 2011

    Posted 28 Jan 2011 Link to this post

    fair enough..
    one more question.. the datable contains a not nullable column.. when I add the new row and do not populate the data in the not nullable column, I'm getting error Column "columnname" does not allow nulls. However when I check it again, the row was not even added to the datatable. Therefore every time I click add the new row the error "Column "columnname" does not allow nulls" always comes up.. any ideas? thanks

  6. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 01 Feb 2011 Link to this post

    Hello ronald,

    Some additional logic has to be inserted into the AddingNewDataItem event to make this work correctly.

    void radGridView_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e)
    {
     e.Cancel = true;
     var newRow = this.dataSource.DefaultView.AddNew();
     newRow["FirstName"] = "John"; // provide default value if needed
     newRow["LastName"] = "Doe"; // provide default values if needed
     this.radGridView.ScrollIntoViewAsync(newRow,  =>
     {
      GridViewRow row = f as GridViewRow;
      if (row != null)
      {
       ((GridViewCell) row.Cells[0]).BeginEdit();
      }
     });
    }



    Kind regards,
    Milan
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  7. Miguel Peixoto
    Miguel Peixoto avatar
    10 posts
    Member since:
    Nov 2010

    Posted 21 Feb 2011 Link to this post

    Hi Milan,

    I'm having the a problem with the approach you gave to Ronald and hope you can help me sort this out.

    When the new row enters in the mode (...BeginEdit()) and after I hit the tab key, it doesn't move to the next cell and appears to exit the edit mode.

    On the other hand, if I don't use this ScrollIntoViewAsync approach, and simply call BeginInsert(), then everything seems to work ok (in what comes to moving to the next cell). But then I don't get my desired default values...

    UPDATE: On more detail... I'm overriding the default return key behaviour through a custom KeyCommandProvider. Instead of CommitEdit, it moves to the next cell. When it's the last cell, then it commits the changes and creates a new row with the later approach and using ScrollIntoViewAsync.

    Thanks.
  8. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 24 Feb 2011 Link to this post

    Hi Miguel Peixoto,

    Is it possible to send us a sample application where this problem can be reproduced?



    Kind regards,
    Milan
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  9. Yogaa
    Yogaa avatar
    3 posts
    Member since:
    Jul 2014

    Posted 13 Oct 2015 Link to this post

    Hi Milan,

     I am too facing a similar kind off issue with WPF radgrid, where in I have data template with a textbox in it with couple of properties binded, when I click on "Click here to add new item" (click) on pressing the tab button the textbox control gets focus it seems to be in read-only mode, how can we get focus on the (click).

    I have also attached mine sample POC, kindly pls suggest an appropriate fix for this case.

    To simulate the exact issue hit "Click here to add new item" and press Tab.

    Also with data in the grid when we pressTab key the text within the textbox hides. how can we fix this with / without code behind (mvvm)

    Thanks in advance.

    Pls rename extension '.png' with'. zip'

    Regards,

    Yogaa

  10. Stefan X1
    Admin
    Stefan X1 avatar
    521 posts

    Posted 16 Oct 2015 Link to this post

    Hello Yogaa,


    Your attachment is not visible on my side. Please note, that our ticketing system does not allow attaching projects in a forum thread. So, I would encourage you to open a new support thread and attach the sample project you referred to in it.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready