asp.net mvc - Data not loading on partial view, MVC -
asp.net mvc - Data not loading on partial view, MVC -
i doing work on form user can come in client record....view scaffold create controller. on 'create' view, user can come in 'engineno' check details passes action "checkrecord",,it can seen view...
<form> <input type="text" id="enginno" /> <input type="button" value="search" id="btnsearch" /> </form> @using (html.beginform("index","home",formmethod.get)) { @html.antiforgerytoken() <div id="info"> @{html.renderaction("checkrecord","sales");} </div> create fields }
the create , "checkrecord" actions are,,
public actionresult create() { viewbag.customerid = new selectlist(db.customersdms, "customerid", "name"); viewbag.smclientbranchid = new selectlist(db.smclientbranchesdms, "smclientid", "name"); viewbag.enginenumber = new selectlist(db.stockdms, "enginenumber", "chasisnumber"); homecoming view(); } public actionresult checkrecord(string enginno) { var results = db.stockdms.where(c=>c.enginenumber ==enginno); homecoming partialview("_part",results); }
and partialview,,,
@model ienumerable<sm.crm.autosloan.models.core.domainmodels.stockdm> @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.autocompanybrand.name) </td> <td> @html.displayfor(modelitem => item.smclientbranch.name) </td> }
my problem is, partial view rendered correctly model of partial view doesn't have value,,,why that, doing wrong...please help,,,thanks time
(posting reply since mentioned in comments , that's not right place)
your action checkrecord(string enginno)
takes argument of enginno
, you're calling without argument. in turn means db lookup not homecoming results, unless results on..
var results = db.stockdms.where(c => c.enginenumber == null);
make sure action gets valid argument, example:
@{ html.renderaction("checkrecord", "sales", new { enginno = "abc123" }); }
asp.net-mvc asp.net-mvc-4 asp.net-mvc-5 partial-views
Comments
Post a Comment