asp.net mvc - MVC4 Passing Model to Controller - Some of Model Null -


i having problems sending model form on view controller. main class has data in sub classes have lost values.

i have main quotation class this:

public class quotation {     public string quotationid { get; set; }     public taxipartner taxipartner { get; set; }     public taxicompany taxicompany { get; set; }     public int maxnumberofseats { get; set; }     public int maxnumberofbags { get; set; }     public double price { get; set; } } 

then example have taxipartner class:

public class taxipartner {     public string id { get; set; }     public string name { get; set; }     public list<address> addresses { get; set; }     public bool supportspasswordreset { get; set; }     public bool supportsvalidatebysms { get; set; } } 

here form in view

@if (model.listofquotations.count > 0) { <h3>you can book online with:</h3> foreach (var item in model.listofquotations) {     using (html.beginform("bookingpage1", "searchresults", formmethod.post))     {      <div class="well">     <div>         <h4>@item.taxicompany.name</h4>     </div>     <div style="float: right;">         <h2>@string.format("{0:c}", item.price)</h2>     </div>     <div>         <b>product type:</b>         <img style="width: 15px;" src="~/content/images/icon-@item.taxipartner.cabforceproducttype-orange-40px.png" />         (1 = best value, 2 = executive, 3 = minibus)     </div>     <div><b>services:</b> @item.taxicompany.services (0 = outdoor pickup, 1 = meet & greet pickup)</div>     <div><b>maximum number of seats:</b> @item.maxnumberofseats <b>maximum number of bags:</b> @item.maxnumberofbags</div>     <div>@html.actionlink("book now", "bookingpage1", item, new { @class = "btn btn-success" })</div> </div>     } } 

}

i have following action in controller:

[httppost]     public actionresult bookingpage1(quotation chosenquote)     {         return view();     } 

when controller action called can see values quotationid, maxnumberofseats, maxnumberofbags, , price values contained in taxipartner , taxicompany null?

i have debugged , value of "item" in view contain values need have disappeared once gets controller.

can see doing wrong please?

only model fields assigned input types available in controller


Comments