I have a problem with inserting new row. Calling method BeginInsert() doesn't work. Default shortcut "F1" doesn't work too. It was worked, if itemssource was localy defined. I have local class, and I've created a List<localClass>. When I change itemssource on Web Service, this doesn't work. I see data in RGV, but I can't insert inplace methode.
Unfortunatelly I can't do example for you, because with local structure it is working.
Regards,
Marcin
7 Answers, 1 is accepted
Please make sure your source collection implements either IList, or IEditableCollectionView.
Not implementing one of these interfaces is the most common reason for RadGridView not being able to insert new item
Greetings,
Pavel Pavlov
the Telerik team
For itemssource I set System.Collections.Generic.List of my object. I think, that is correct. Should I do something more? This structure was always working, but I use "in place insert" first time in SL.
Greetings,
Marcin
BeginInsert() might not also work when the data items do not have a public parameterless constructor - in such situations the grid cannot create new item and respectively insert it in the source collection. If that is the case you can use the AddingNewDataItem event to manually construct new objects.
More information on this topic can be found here.
Sincerely yours,
Milan
the Telerik team
Localy I have List<class> and it was OK. From Web Service I recived List<struct> and it doesn't work. So I changed struct to class and everything is OK.
Regards,
Marcin
BeginInsert() might not also work when the data items do not have a public parameterless constructor - in such situations the grid cannot create new item and respectively insert it in the source collection. If that is the case you can use the AddingNewDataItem event to manually construct new objects.[/quote]
I have the same issue. I wanted to use a button click event to add a new item in my GridView. So in the click handler I call the BeginInsert() of my GridView and nothing happens. I've set breakpoints and debugged and it never even goes into the AddingNewDataItem event handler. The weird thing is that I have 2 GridViews, but 1 works and 1 doesn't. They are both identical in terms of XAML properties and both have an ObservableCollection<class> for their ItemsSource where each class has a parameterless constructor.
I would add that before I tried to use the button click to trigger the new item, I was using the ShowInsertRow="True" property of the GridView to where it has that first row that says, "Click here to add a new item," and on the GridView that works, it would add the new item with one click. However, the GridView that doesn't currently work, it required me to click that row 2 times before it would add the new item. I'm not sure if this has something to do with why the BeginInsert() doesn't work for the button, but it definitely was the reason I moved to the button.
I've tried to reproduce your problem, but to no avail. I have attached my test project for a reference. Could you check it and modify it in order to demonstrate the issue?
Regards,
Yoan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.