asp.net mvc - How to send the strongly typed model object from VIEW to CONTROLLER -
hi have typed view in mvc.
the model renders data in view.
how can send model object view data controller on form submit.
controller 1 sends model object
return view(currentuser);   view receives model object
@model webapp.models.userentity   <h4><b>contact information:</b></h4>                 <ul>                     <li>                         <h4><b> name:- @model.firstname  @model.lastname </b></h4>                     </li>                      <li>                         <h4><b> address1:- @model.address1</b></h4>                     </li>                      <li>                         <h4><b>address2:- @model.address2</b></h4>                     </li>                      <li>                         <h4><b> attention:- @model.attention</b></h4>                     </li>                      <li>                         <h4><b> city:- @model.city</b></h4>                     </li>                     <li>                         <h4><b> state:- @model.statename</b></h4>                     </li>                     <li>                         <h4><b> zip:- @model.zip</b></h4>                     </li>                     <li>                         <h4><b>homephone:- @model.homephone</b></h4>                     </li>                     <li>                         <h4><b>cellphone:- @model.cellphone</b></h4>                     </li>                 </ul>   how send model along data controller 2 parameter??
please suggestions , approach feasible.
you're going need to
- enclose view contents in form posts controller2.
 - add form (text boxes, hidden fields, etc) contain model properties
 - add submit button
 
i wondering why doing this, though. seems odd post data controller instead of action on same controller.
@using (html.beginform("actionname", "controller2") {      @html.hiddenfor(model => model.firstname)      ... }      
Comments
Post a Comment