Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is difficult to help without seeing the entire exception stacktrace. Here are a few tips:</p> <ul> <li>Make sure that your partial <code>Inherits="System.Web.Mvc.ViewUserControl&lt;IEnumerable&lt;assist&gt;&gt;"</code> and not <code>Inherits="System.Web.Mvc.ViewPage&lt;IEnumerable&lt;assist&gt;&gt;"</code>. You are using an ASCX partial and inheriting from <code>System.Web.Mvc.ViewPage</code> which is wrong.</li> <li>Make sure that your partial view is called exactly the same as the controller action: <code>getFilterdData.ascx</code> (I see a typo here)</li> <li>Make sure that the <code>Assist</code> class contains a property called <code>assist_a</code> as that's what you are using when rendering the dropdown</li> <li>Make sure there is no exception being thrown inside the <code>getFilterdData</code> controller action while you are fetching the data.</li> </ul> <p>Here's a working example:</p> <p>Model:</p> <pre><code>public class Assist { public string Id { get; set; } public string Value { get; set; } } </code></pre> <p>Controller:</p> <pre><code>public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult GetFilteredData() { // TODO: replace with your repository logic ViewData["Assists"] = new SelectList(new[] { new Assist { Id = "1", Value = "Assist 1" }, new Assist { Id = "2", Value = "Assist 2" }, new Assist { Id = "3", Value = "Assist 3" }, }, "Id", "Value"); return View(); } } </code></pre> <p>View (<code>~/Views/Home/Index.aspx</code>):</p> <pre><code>&lt;% Html.RenderAction("GetFilteredData"); %&gt; </code></pre> <p>Partial: (<code>~/Views/Home/GetFilteredData.ascx</code>):</p> <pre><code>&lt;%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl&lt;IEnumerable&lt;Assist&gt;&gt;" %&gt; &lt;%= Html.DropDownList("Assists", (SelectList)ViewData["Assists"], "--Select One--") %&gt; </code></pre>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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