Mvc beginform没有提交按钮 [英] Mvc beginform without submit button
本文介绍了Mvc beginform没有提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。我试图通过beginform将值从视图传递到模态。
不使用Ajax
我尝试过:
这是我的观点
@using(Html.BeginForm (ChangeStage,DropDown,FormMethod.Post))
{
< label> Select Gate< / label>
@ Html.DropDownListFor(m => m.GateName,new DropboxChange.Models.DropModal()。GateDropdown,new {@class =form-control})
}
这是我的控制器
public ActionResult ChangeStage(string GateName)
{
return View();
}
i需要将下拉值传递给我的控制器而不需要任何提交按钮和ajax。请帮助!!!
解决方案
< select id =countrylist>
< option> Single< / option>
< option> Single2< / option>
< / select>
(document).ready(function(){
('#countrylist')。change(函数(E){
Hi all. i am trying to pass value from view to modal via beginform.
without use Ajax
What I have tried:
this is my View
@using (Html.BeginForm("ChangeStage", "DropDown", FormMethod.Post)) { <label>Select Gate </label> @Html.DropDownListFor(m => m.GateName, new DropboxChange.Models.DropModal().GateDropdown, new { @class = "form-control" }) }
And this is my Controller
public ActionResult ChangeStage( string GateName) { return View(); }
i need to pass dropdown value to my controller without any submit button and ajax. please help !!!
解决方案
<select id="countrylist"> <option>Single</option> <option>Single2</option> </select>
(document).ready(function(){
('#countrylist').change(function(e){
这篇关于Mvc beginform没有提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文