0

I’ve created a simple Razor view using Html.BeginForm. The form contains a table populated from the controller.

To keep everything client side, I created an add button that calls javascript which adds rows to the table with html inputs. I like this approach since it limits calls to the server and allows for a cancel of all changes prior to a save.

I was thinking (it seems quite ignorantly) that upon submit I would have access to the html table. That does not seem to be the case. So do I need to scrap my design (at least the add function) or can I reference the table (page’s html) in the controller? If I can reference it, does this create a potential security issue?

Any help or on line example much appreciated.

mad moe
  • 322
  • 3
  • 14

1 Answers1

0

Not a good approach!! but you can use Request.Form or FormCollection object.

How to retrieve form values from HTTPPOST, dictionary or?

Read second answer it may help else do googleing for acessing form controls in mvc controller

Community
  • 1
  • 1
Deepesh
  • 5,346
  • 6
  • 30
  • 45
  • Thanks, btw: is this not a good approach because of using javascript to add rows? or tabular edit in general? – mad moe Jul 10 '12 at 04:41
  • You can but with MVC you should try to use Model object instead of Form collection. Though no harm in it but when it comes to standard we should try to design application in this manner. In your scenario its ok that you want to avoid server trip, i am not sure but knockout.js can be helpful in this case!! – Deepesh Jul 10 '12 at 04:48