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

CRUD in NestedViewTemplate Hierarchy

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Orlando
Top achievements
Rank 1
Orlando asked on 08 Sep 2010, 03:24 PM
I am trying to do something like the Hierarchy Template demo,

http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx

In the inner multi-tab views, I'd like to have Insert/Update/Delete than just viewing. When I followed the example to save the 'parent' primary key (ID) into a label control, it turned out that Delete/Update work, but to add a new record will trigger a key conflict error in SQL. I used SQL Profiler to trace it and found that the sql statement has '0' for the ID field (it's an identity field).

Please help.

and also, why that example uses label control to save the parent primary key, instead of using ParentTableRelation?

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 13 Sep 2010, 12:18 PM
Hello Orlando,

In order to overcome the issue you can handle the ItemCommand event of the inner grid for the InitInsertCommand and set predefined value for the parent row ID. You can see how this could be done in this article.

The example is not using ParentTableRelations for illustration purposes, e.g. it shows the other possible approach.

Best wishes,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Orlando
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or