У меня есть DropDownListДля моего просмотра. На самом деле у меня 3, из трех из них работают только двое. Несмотря на то, что я почти точно такой же код, в настоящий момент мне нужно создать окно ввода и заполнить его одним нажатием кнопки со значением из раскрывающегося списка (странно, я знаю, я могу получить значение с помощью JQuery). Я проверил, и все имена кажутся одинаковыми, поэтому я действительно не уверен, почему он не отправляется.Почему моя нисходящая ценность не отправляется в действие?
Вид:
<content id="GenerateReportContent" class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
@using (Html.BeginForm("ReportSelection", "Search", FormMethod.Post, new { @id = "GenerateReportContainer" })) {
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="AltFunctions">
<ul>
<li>
<a href="javascript:document.getElementById('GenerateReportContainer').reset();" class="AltButton" id="altClearButton" title="Reset the 'Generate Report' container" >Clear</a>
</li>
<li>
<a href="#GRModal" data-toggle="modal" data-target="#GRModal" class="AltButton" id="GRaltInfoButton" title="Information on the 'Generate Report' container">Info</a>
</li>
</ul>
</div>
<h1 id="GenerateReportHeader">SEARCH ENGINE</h1>
</div>
<input type="hidden" name="ClientID" value="@Model.ClientID" id="Client" />
<input type="hidden" name="ClientName" value="@Model.ClientName" id="ClientName" />
<input type="hidden" name="SupplierFound" value="@Model.SupplierFound" id="SupplierFound" />
@Html.TextBoxFor(m => m.ClaimNo, "", new { @id = "txtGRCSelect", @class = "form-control", placeholder = "Enter Specific Claim Number..." })
<br />
<div class="ui-widget">
@Html.TextBox("SupplierAuto", "", new { @id = "SupplierAutotxt", @class = "form-control SupplierAutoComplete", placeholder = "Search for a supplier name" })
</div>
@Html.DropDownListFor(m => m.SupplierID, new SelectList(Model.Suppliers, "SupplierID", "DisplayName"), "Select Supplier Name", new { @id = "SuppNameDD", @class = "GRDropDown"})
<br />
<!-- THE DROP DOWN IN QUESTION-->
@Html.DropDownListFor(m => m.GroupModelClass.GroupID, new SelectList(Model.GroupModelClass.ClaimGroups, "GroupID", "GroupName"), "Select Supplier Group Name", new { @id = "SuppGroupDD", @class = "GRDropDown" })
<br />
@Html.DropDownListFor(m => m.ReviewPeriodID, new SelectList(Model.ReviewPeriods, "ReviewPeriodID", "ReviewPeriodName"), "Select Review Period", new { @id = "ReviewPeriodDD", @class = "GRDropDown" })
// Have to submit this field at the moment as the drop down value is not being submitted
<input hidden id="GroupIDInput" name="GroupIDInput" />
<br />
<br />
<button type="submit" value="Submit" id="GenerateReportButton" class="btn btn-default">GO</button>
<div id="ErrorBox" hidden>
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
<p id="ErrorBoxText"></p>
</div>
</div>
}
</content>
Контроллер:
public ActionResult ReportSelection(int ClientID, string ClaimNo, string SupplierAuto, int? SupplierID = null, int? ReviewPeriodID = null, int? GroupID = null) {
if (SupplierAuto != "") {
var Suppliers = suppRepo.GetAllSuppliersByClientWithClaims(ClientID);
foreach (var item in Suppliers) {
if (item.DisplayName == SupplierAuto) {
SupplierID = item.SupplierID;
break;
}
}
if (SupplierID == null) {
return RedirectToAction("Index", "Dashboard", new { ClientID = ClientID });
}
}
client = clientRepo.GetClientNameByID(ClientID);
if (SupplierID != null || ReviewPeriodID != null || GroupIDInput != null) {
return RedirectToAction("SupplierReportSelection", new { ClientID = ClientID, SupplierID = SupplierID, ReviewPeriodID = ReviewPeriodID, ClaimIDs = ClaimIDs });
}
else {
return RedirectToAction("ClaimNumberReportSelection", new { ClientID = ClientID, ClaimNo = ClaimNo });
}
}
Кто знает, почему он не работает?