How to enter edit mode on AddingNewDataItem event

5 posts, 0 answers
  1. Steve Y
    Steve Y avatar
    115 posts
    Member since:
    Sep 2008

    Posted 19 Nov 2009 Link to this post

    I am trying to emulate the insert button press on a gridview where the insert button is pressed, a new row is added to the grid, the row is selected, it goes into edit mode, and the first cell has the cursor sitting in it ready for data input.

    I'm using Ria Services and supplying a QueryableCollectionView to the grid's ItemsSource so that paging an filtering all work. Of course, the insert key doesn't work here automatically, so I want to do an insert in code behind.

    I'm capturing the <insert> button press using the AddingNewDataItem event handler. I have successfully added the new data item into the collection using e.NewObject. The grid shows the new row at the top of the grid. However, it's not selected and the row is not in edit mode and the cursor is not sitting in the first cell... How do I do this last but important part?

    I found some code way back from May which suggested using ChildrenOfType but I can't find the method. I've added all the Telerik assemblies I could find but I could not find one that resolves it. I've now assumed that things have changed in the new SL stuff and that this may now not be available/the way to do it.

    How do I get the new row selected and in edit mode?

    Thanks, Steve

    private void rgvProperties_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e) 
            { 
                rtp_Properties newProperty = new rtp_Properties(); 
                e.NewObject = newProperty; 
     
                //var rgv = this.rgvProperties; 
                //rgv.ChildrenOfType<GridViewNewRow>().First().BeginEdit();  
            } 

  2. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 25 Nov 2009 Link to this post

    Hi Steve Y,

    It seems that you've hit an issue in our control. When new row is shown first editable cell should be in edit mode. I've managed to simulate the issue and as soon as fix is available I'll notify you. In order to use ChildrenOfType<T> method you have to add using for the Telerik.Windows.Controls namespace. Unfortunately when you look for the new row it is not created yet and therefore cannot be found.

    P.S. I've updated your Telerik points accordingly. We are doing our best in order to fix this for the upcoming latest internal build. Sorry for the inconvenience caused.

    Greetings,
    Nedyalko Nikolov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 20 Jan 2010 Link to this post

    Hello Steve Y,

    Sorry for the late reply. Your issue with the new row should be fixed with our latest binaries. Let me know if you have any related issues.

    Best wishes,
    Nedyalko Nikolov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 28 Oct 2011 Link to this post

    Hi Nedyalko Nikolov ,

    Sorry to bringing it up, but I'm facing the same issue, when i click on the "Click here to add new row " of the GridView
    i need to put the third cell in edit mode,

    I'm using the 2010.2.812.1040 version of assemblies, the fix that you say are present in this version?

    I need this because I have a Button inside of the first cell of my GridView, and when the user click's to add a new row, the "cursor" are on the first cell so the button doesn't apper untill he click's in another cell.

    I'll attache a sample image for you see.

    Thanks!
  6. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 28 Oct 2011 Link to this post

    Hi,
    I look into the documentation and i find this article that's work just great!

    http://www.telerik.com/help/silverlight/gridview-how-to-focus-first-cell-insert.html

    Thanks!
Back to Top
DevCraft banner