Note that there are some explanatory texts on larger screens.

plurals
  1. POreturn RedirectToAction() not passing object
    primarykey
    data
    text
    <p>I have two partialViews in my ASP.NET MVC4 Application-</p> <pre><code>[HttpGet] public ActionResult Autocomplete_Search(string accountHead, List&lt;LedgerModel&gt; ledge) { if (!String.IsNullOrEmpty(accountHead)) { ledge = (from u in db.LedgerTables where u.AccountHead.Contains(accountHead) &amp;&amp; u.FKRegisteredRecord == this.LoggedInUser.RegisterID select new LedgerModel { AccID = u.AccID, Place = u.Place, AccountHead = u.AccountHead, DateAccountHead = Convert.ToDateTime(u.DateAccountHead) != null ? Convert.ToDateTime(u.DateAccountHead) : DateTime.Now }).ToList(); return RedirectToAction("_ProductSearchList", ledge); } return View(); //return Json(ledge, JsonRequestBehavior.AllowGet); } </code></pre> <p><strong>And-</strong></p> <pre><code>public ActionResult _ProductSearchList(List&lt;LedgerModel&gt; ledge) { List&lt;LedgerModel&gt; ledger = null; if (ledge != null) { ledger = (from u in ledge select new LedgerModel { AccID = u.AccID, Place = u.Place, AccountHead = u.AccountHead, DateAccountHead = Convert.ToDateTime(u.DateAccountHead) != null ? Convert.ToDateTime(u.DateAccountHead) : DateTime.Now }).ToList(); return PartialView(ledge); } else { return PartialView(ledge); } } </code></pre> <p>Okay now when I send string through a textbox, Action <code>AutoComplete_Search</code> is called. At the time of redirection to another method named <code>_ProductSearchList</code> I am sending an object <code>ledge</code> of listType to This method. But It says <code>ledge</code> null in <code>_ProductSearchList</code> action's parameters.</p> <p>However this object is a list type and contains records. How do I get this object <code>ledge</code> which is redirected to action <code>_ProductSearchList</code>?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload