Using DataForm on insert

3 posts, 0 answers
  1. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 08 Feb 2012 Link to this post

    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. Ivan Ivanov
    Ivan Ivanov avatar
    1114 posts

    Posted 13 Feb 2012 Link to this post

    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 >>
  3. DevCraft R3 2016 release webinar banner
  4. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 13 Feb 2012 Link to this post

    That still has an active editable row, in addition to the editable form.

    Which can cause nothing but confusion.
Back to Top