Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display text from a dropdown in MVC
    text
    copied!<p>I have a partial view that has to display records on the change of dropdown. The values are coming correctly but it is not being displayed in the tex boxes. Please help. THe code of my partial view looks like below</p> <pre><code>@using (Ajax.BeginForm("W2State", new AjaxOptions() { UpdateTargetId = "model", OnSuccess = "w2Updated", InsertionMode = InsertionMode.Replace, HttpMethod = "Post" } )) { &lt;fieldset id="currencyView" class="detailView"&gt; &lt;table&gt; &lt;tr&gt; &lt;td style="width: 100px;"&gt;Select Agency &lt;/td&gt; &lt;td&gt; @*@Html.DropDownListFor(model =&gt; model.ReportingAgencies, new SelectList(Model.ReportingAgencies, "SelectedAgency.AgencyGuid", "SelectedAgency.Name"), new { id = "dropDownReportAgencies" })*@ @Html.DropDownListFor(model =&gt; model.ReportingAgencies, new SelectList(Model.ReportingAgencies, "SelectedAgency.AgencyGuid", "SelectedAgency.Name"), "--Select An Agency--", new { id = "dropDownReportAgencies" }) &lt;/td&gt; &lt;/tr&gt; &lt;tr class="seperator"&gt;&lt;/tr&gt; &lt;tr class="seperator"&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 100px;"&gt;@Html.LabelFor(model =&gt; model.W2StateLocal.Wages)&lt;/td&gt; &lt;td&gt; @Html.TextBoxFor(model =&gt; model.W2StateLocal.Wages)&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 100px;"&gt;@Html.LabelFor(model =&gt; model.W2StateLocal.Tax)&lt;/td&gt; &lt;td&gt;@Html.TextBoxFor(model =&gt; model.W2StateLocal.Tax)&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="rightButtonControls"&gt; @if (Model.IsEditable) { &lt;button id="btnSave" value="save"&gt;Save&lt;/button&gt; } &lt;/div&gt; &lt;/fieldset&gt; } @Html.HiddenFor(model =&gt; model.CompanyId, new { id = "CompanyId" }) @Html.HiddenFor(model =&gt; model.EmployeeId, new { id = "EmployeeId" }) @Html.HiddenFor(model =&gt; model.FilingYear, new { id = "FilingYear" }) &lt;script type="text/javascript"&gt; $(document).ready(function () { $("#divLoader").css('display', 'none'); $('#dropDownReportAgencies').change(function () { var selectedAgency = $('#dropDownReportAgencies option:selected').val(); var CompanyId = $('#CompanyId').val(); var EmployeeId = $('#EmployeeId').val(); var FilingYear = $('#FilingYear').val(); var url = '@Url.Action("W2State", "W2Generation")'; $.get(url, { agencyId: selectedAgency, companyId: CompanyId, employeeId: EmployeeId, filingYear: FilingYear }, function (data) { }); }); }); </code></pre>
 

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