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

How to enter edit mode on AddingNewDataItem event

4 Answers 207 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steve Y
Top achievements
Rank 2
Steve Y asked on 19 Nov 2009, 06:49 PM
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();  
        } 

4 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 25 Nov 2009, 09:36 AM
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.
0
Nedyalko Nikolov
Telerik team
answered on 20 Jan 2010, 11:28 AM
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.
0
Missing User
answered on 28 Oct 2011, 01:26 PM
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!
0
Missing User
answered on 28 Oct 2011, 03:28 PM
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!
Tags
GridView
Asked by
Steve Y
Top achievements
Rank 2
Answers by
Nedyalko Nikolov
Telerik team
Missing User
Share this question
or