c# - Display FormCollection with ASP.NET MVC -


i have form using html.beginform() on view. have in controller actionresult handle post. need kick results view. can kick off new view, don't know how pass data , once there don't know how display it. here's have in actionresult.

[httppost]         public actionresult index(formcollection collection)         {               viewbag.title = "confirm order";             return view("orderconfirmation", collection);         } 

if return view("orderconfirmation"); go view know got working. don't know how pass data. right have typed same model form causes errors because formcollection not same obviously. if remove typed line above works, have no idea how loop through collection @ point.

thanks help.

use viewmodel , stongly typed view. can pass model second view.

public actionresult index(order order) {   return view("orderconfirmation", order); } 

asp.net mvc automatically create order instance , fill properties posted formcollection.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -