This is a migrated thread and some comments may be shown as answers.

Edit mode Programmaticaly.

3 Answers 65 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 30 Aug 2011, 04:30 PM
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.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 31 Aug 2011, 07:48 AM
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 >>

0
Paul
Top achievements
Rank 1
answered on 31 Aug 2011, 12:42 PM
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.
0
Nedyalko Nikolov
Telerik team
answered on 03 Sep 2011, 10:00 AM
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 >>

Tags
TreeListView
Asked by
Paul
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Paul
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or