2
我有一個具有一個下拉和上下拉的變化,需要更新在相應的文本框中的值,但沒有顯示EVN值雖然局部視圖下拉的變化在文本框中的值價值在那裏。請幫助顯示基於
我的代碼看起來像下面
@Html.DropDownListFor(model => model.ReportingAgencies, new SelectList(Model.ReportingAgencies, "SelectedAgency.AgencyGuid", "SelectedAgency.Name"), "--Select An Agency--", new { id = "dropDownReportAgencies" })
</td>
</tr>
<tr class="seperator"></tr>
<tr class="seperator"></tr>
<tr>
<td style="width: 100px;">@Html.LabelFor(model => model.W2StateLocal.Wages)</td>
<td> @Html.EditorFor(model => model.W2StateLocal.Wages)</td>
</tr>
<tr>
<td style="width: 100px;">@Html.LabelFor(model => model.W2StateLocal.Tax)</td>
<td>@Html.EditorFor(model => model.W2StateLocal.Tax)</td>
</tr>
</table>
<div id="rightButtonControls">
@if (Model.IsEditable)
{
<button id="btnSave" value="save">Save</button>
}
</div>
</fieldset>
}
@Html.HiddenFor(model => model.CompanyId, new { id = "CompanyId" })
@Html.HiddenFor(model => model.EmployeeId, new { id = "EmployeeId" })
@Html.HiddenFor(model => model.FilingYear, new { id = "FilingYear" })
<script type="text/javascript">
$(document).ready(function() {
$("#divLoader").css('display', 'none');
$('#dropDownReportAgencies').change(function() {
var selectedAgency = $('#dropDownReportAgencies option:selected').val();
alert(selectedAgency);
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) {
}
);
});
});
但值不被顯示在文本字段。請幫助我
你想在這裏更新哪個文本框? – artsylar
值不會顯示在*,其中*的文本字段?我看到你用selectedAgency做的唯一事情就是提醒它,而不是設置任何東西。 – ethorn10
@ Html.EditorFor(型號=> model.W2StateLocal.Tax)是顯示框,我想從我的視圖模型 – Rash