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

Using DataForm on insert

2 Answers 97 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 08 Feb 2012, 05:29 PM
I'm trying to create a grid that uses RadDataForm to display and to edit row details, and which also supports insert and delete of rows.

My current problem is getting insert to work using the same form layout as the edit.  By default, the insert-row drops you into editing the row in the grid, rather than editing a new record in a detail DataForm.

Browsing the forums showed me this thread - and with this I was able to override the GridViewNewRow template - but if that's only part of the solution, at best.

My grid has ShowInsertRow="False", instead I have a button that triggers RadGridViewCommands.BeginInsert.  When I click that, I still end up editing the rows of the grid, and not in a DataForm.

When I set ShowInsertRow="True", I don't see the "Click here to add new item" row, instead I see my GridViewNewRow template, but clearly bound incorrectly: "BindingExpression path error: 'CurrentItem' property not found on 'object'."

It seems to me that if most people who are displaying and editing row details in a data form, whether a RadDataForm or something custom, are also going to want to insert new rows using that same data form.

But if there's a way to do it, I've not been able to find it.

---  EDITED ---

OK, one thing I've figured out.  The GridViewNewRow template only controls the appearance of the "Click here to add new item" row - it has nothing to do with the row on which the editing is actually done.  Which still leaves me not knowing how to get the grid to use a RadDataForm for inserting new rows, when it is configured to use a RadDataForm to display and edit rows.

2 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 13 Feb 2012, 04:22 PM
Hi Jeff,

I believe that you do not need to set a GridViewNewRow template in your scenario. I have prepared a very simple example project for you that illustrates how to achieve similar behavior by defining a RowDetailsTemplate that contains a RadDataForm control. The project is attached for your reference. As a side note, you may use RadGridView's default keyboard command binding for the BeginInsert command - the "Insert" key, instead of adding additional buttons.

Kind regards,
Ivan Ivanov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Jeff
Top achievements
Rank 1
answered on 13 Feb 2012, 07:53 PM
That still has an active editable row, in addition to the editable form.

Which can cause nothing but confusion.
Tags
DataForm
Asked by
Jeff
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or