ドロップダウンを選択すると、ドロップダウンの値がコントローラーのアクションメソッドに表示されません。選択した値は、Ajaxで結合が、あなたが直接あなたが合格しなければならない代わりに、AJAX呼び出しに値を渡しているコントローラのアクションメソッドで see our pageコントローラーデータの受け渡し
<div class="row">
<div class="col-lg-3">
<fieldset class="form-group">
<label class="form-label semibold control-label">Generic</label>
@Html.DropDownList("MasterGenericID", null, "--- Select Generic ---", new { @class = "select2-arrow" })
</fieldset>
</div>
$('#btnsearch').click(function() {
var genericID = $('#MasterGenericID').val();
$.ajax({
type: 'POST',
url: "@Url.Action("ProductMasterController", "ProductMasterview")",
data: JSON.stringify(GenericID),
contentType: "application/json",
dataType: 'json',
success: function(data) {
// if (response.id > 0)
alert("test" + data.GenericID);
},
async: true // make it true if you want to make an async call.
});
});
public ActionResult ProductMasterview(string GenericID)
if (Convert.ToInt32(GenericID) > 0)
{
return View(dPMSP.GetAllProductsUsingGenericID(GenericID));
}
else
{
Generic_Bind();
Therapeutic_Bind();
SubTherapeutic_Bind();
Formulation_Bind();
return View(dPMSP.GetAllProducts());
}
}
おかげ
アクション定義に '{' –