asp.net mvc 4 - ViewModel List object return Null on HTTPPost -
i posting form server, values null.
model:
public class rdetailsviewmodel { public rdetailsmaster rdetailsmaster { get; set; } public etransaction etransaction { get; set; } } public class rdetailsmaster { [required] public list<qe_dropdown_mst> master_eq { get; set; } [required] public list<qe_dropdown_mst> master_basis { get; set; } [required] public list<qe_dropdown_mst> master_te { get; set; } [required] public list<qe_dropdown_mst> master_alop { get; set; } [required] public list<qe_dropdown_mst> master_risk { get; set; } [required] public list<qe_dropdown_mst> master_excess { get; set; } [required] public list<qe_dropdown_mst> master_ctype { get; set; } }
controller:
[httppost] public actionresult rdetails(rdetailsviewmodel objr) { return view(); }
my view :
@model qms_erater.viewmodels.rdetailsviewmodel @{ viewbag.title = "rdetails"; } <script src="~/scripts/ear/rdetails.js"></script> @using (html.beginform("rdetails", "rdetails", formmethod.post)) { <h2>rdetails</h2> <div class="well well-sm"> <div id="divdetail101" runat="server"> <div class="row"> <div class="col-sm-4"> <span style="vertical-align: top; color: red">*</span> eq : </div> <div class="col-sm-3"> @html.dropdownlistfor(m => m.etransation.eq, new selectlist(model.rdetailsmaster.master_eq, "value", "description"), "--select--", new { style = "width: 100%;" }) </div> <div class="col-sm-2"> <span style="vertical-align: top; color: red">*</span> on first loss basis : </div> <div class="col-sm-3"> @html.dropdownlistfor(m => m.etransation.basis, new selectlist(model.rdetailsmaster.master_basis, "value", "description"), "--select--", new { style = "width: 100%;" }) </div> <div class="col-sm-4"> <span style="vertical-align: top; color: red">*</span> terrorism : </div> <div class="col-sm-3"> @html.dropdownlistfor(m => m.etransation.is_te, new selectlist(model.rdetailsmaster.master_te, "value", "description"), "--select--", new { style = "width: 100%;" }) </div> <div class="col-sm-2"> <span style="vertical-align: top; color: red">*</span> alop : </div> <div class="col-sm-3"> @html.dropdownlistfor(m => m.etransation.is_alop, new selectlist(model.rdetailsmaster.master_alop, "value", "description"), "--select--", new { style = "width: 100%;" }) </div> <div class="col-sm-4"> <span style="vertical-align: top; color: red">*</span> wet risk : </div> <div class="col-sm-3"> @html.dropdownlistfor(m => m.etransation.is_risk, new selectlist(model.rdetailsmaster.master_risk, "value", "description"), "--select--", new { style = "width: 100%;" }) </div> </div> </div> <input type="submit" value="submit" /> </div>
}
when trying call post method objr return null value list objects. appreciated. in advance!
Comments
Post a Comment