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

Unable to insert new row with ShowInsertRow

3 Answers 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
cocowalla
Top achievements
Rank 1
cocowalla asked on 31 Jul 2013, 11:08 AM
Editing existing items in the grid works fine, but when I click on 'Click here to add new item', nothing happens.

In my view model I have an IQueryable:
public IQueryable<MyModel> Data
{
  get { return this.dataService.GetData(); }
}

In the view, I have a RadGridView bound to the Data property:
<telerik:RadGridView Name="RadGridView1"
    GroupRenderMode="Flat"
    ShowInsertRow="True"
    CanUserInsertRows="True"
    CanUserFreezeColumns="False"
    ItemsSource="{Binding Data}"
    AutoGenerateColumns="False"
    SelectedItem="SelectedItem"
    ActionOnLostFocus="CommitEdit"
    RowIndicatorVisibility="Collapsed"
    ShowGroupPanel="False">

3 Answers, 1 is accepted

Sort by
0
cocowalla
Top achievements
Rank 1
answered on 01 Aug 2013, 12:31 PM
I've tried binding to a QueryableCollectionView created from the IQueryable, but get the same result
0
cocowalla
Top achievements
Rank 1
answered on 01 Aug 2013, 01:32 PM
So I figured maybe I could use VirtualQueryableCollectionView, and do the paging myself in the ItemsLoading event handler, and convert the page to an IList.

...but I get the same result when binding to VirtualQueryableCollectionView, even when in the ItemsLoading event handler I pass an IList to the Load method :(
0
Rossen Hristov
Telerik team
answered on 05 Aug 2013, 08:44 AM
Hi,

The IQueryable interface is for queries only, i.e. you can only read. If you want to perform CRUD operations, your collection needs to implement either the IList interface or IEditableCollectionView interface.

Since I am not sure where and how your data is coming from, you can check our two data source controls:

RadDataServiceDataSource
RadEntityFrameworkDataSource

You can see those controls in action in our online QSF.

Alternatively, you can edit in-memory data if you bind the grid to an ObservableCollection<T>. Creating such a collection is beyond the scope of Telerik support.

Regards,

Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
cocowalla
Top achievements
Rank 1
Answers by
cocowalla
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or