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

[Solved] Telerik MVC Grid within existing form (inline)

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dan Lewis
Top achievements
Rank 1
Dan Lewis asked on 12 Feb 2011, 01:17 PM
I have a large MVC form that needs to show various additional sets of multi-column information inline within the main form. As example the form would look something like the following:
-----------------------------------------------------------
Question 1: [________]
Question 2: [________]
Question 3:
Name | Type | Yes / No
(Edit / Delete)
(Edit / Delete)
(Insert)

Question 4: [________]

Question 5:
When | Where | Yes / No
(Edit / Delete)
(Edit / Delete)
(Insert)
etc...
[Submit]
-----------------------------------------------------------

For questions 3 and 5, my obvious first choice was to use the Telerik MVC grid, until I realised (of course) that it is generating it's own form tags. I moved the grid outside the main @using (Html.BeginForm()) and everything worked expected, but of course the questions are no longer listed in the correct order.

I am also unable to switch to Ajax mode because a) my child objects are self-referencing and thus generate a serialization error (could overcome this with a ViewModel but would like to avoid this if possible)  and b) from what I have read elsewhere on the forums, certain operations will always generate a form tag (delete and update?) and I need these behaviours on the grid.

Can anyone tell me of a good strategy to achieve something like the above with the Telerik MVC grid, whilst retaining use of the default model binder if possible?

The only alternative I can think of at the moment would be to not use the MVC grid and instead create custom edit / display templates for each multi-value question, whereby the insert would generate a new table row via jQuery that contained standard textboxes / dropdowns etc, but this is obviously going to involve a lot more work / code...

Regards,

Dan.

1 Answer, 1 is accepted

Sort by
0
Gaurav Khanna
Top achievements
Rank 1
answered on 07 Jul 2011, 10:25 PM
Try adding multiple Form tags, like below -

@using (Html.BeginForm("Actions", "Controller", FormMethod.Post))
{
   --Q1
   --Q1
}

@(Html.Telerik().Grid(Q3)

@using (Html.BeginForm("Actions", "Controller", FormMethod.Post))
{
   --Q4
   --Q5
}

I am using the same format is working fine for me.
Tags
Grid
Asked by
Dan Lewis
Top achievements
Rank 1
Answers by
Gaurav Khanna
Top achievements
Rank 1
Share this question
or