Edit mode Programmaticaly.

4 posts, 0 answers
  1. Paul
    Paul avatar
    24 posts
    Member since:
    Jul 2010

    Posted 30 Aug 2011 Link to this post

    Hi,

    I  have a processs that will add a row to my RadTreeListView hierarchichal data source.
    If I have a reference to the item I added, how do I scroll the item into view and force the first cell of its row into edit mode ?...

    Many thanks - Paul.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 31 Aug 2011 Link to this post

    Hi Paul,

     You can use ScrollIntoView/ScrollIntoViewAsync methods to scroll into view particular item and if set this item as CurrentItem you can call BeginEdit() to achieve your goal with first cell editing. 

    Best wishes,
    Vlad
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
  4. Paul
    Paul avatar
    24 posts
    Member since:
    Jul 2010

    Posted 31 Aug 2011 Link to this post

    Hi,

    Thanks for the reply...

    This works... almost... We are adding the new row from a right-click context menu and everything works fine as per your suggestions...

    however...

    The final problem is this; if the user was previously editing another row and they were in column 6 when they right clicked and added a new item, the "BeginEdit" call on the new item causes them to go to column 6 of the new row.

    The desired functionality is always to edit the specific column 0 of the newly added row and not to drop into the column they previosuly had in focus - can we do this - is there some kind of "CurrentColumn" value ?...

    Many thanks - Paul.
  5. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 03 Sep 2011 Link to this post

    Hi Paul,

    Indeed there is such property, which you could use. Just set CurrentColumn before BeginEdit(). Another approach is to call BeginEdit() method on the desired GridViewCell object. I'm pasting a code snippet for a reference:

    this.radGridView.ScrollIntoViewAsync(dataItem, (f) =>
                {
                    GridViewRow row = f as GridViewRow;
                    if (f != null)
                    {
                        ((GridViewCell) f.Cells[0]).BeginEdit();
                    }
                });

    Kind regards,
    Nedyalko Nikolov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top