问题描述
当我使用下面的代码时,我没有得到我的控制器上的命令/值按钮点击。
< input id =btnCreateNewtype =submitsrc =@ Url.Content(../../ Image / create_new.GIF)name =Commandvalue =CreateNew>
和我的控制器就像那样...
public ActionResult Index(string Command,FormCollection fm)
{
if(Command ==CreateNew)
lm = new LocationModel();
lm.location_id = 0;
var GridData = lm.Get_LocationData(lm); //。GetStateData( searchdata);
返回查看(GridData);
}
请提前感谢... ASAP.:)
when i use the following Code than i dont get the the command/value on my contoller At buttonclick.
<input id="btnCreateNew" type="submit" src="@Url.Content("../../Image/create_new.GIF")" name="Command" value="CreateNew" >
and My Controller it is like that...
public ActionResult Index(string Command, FormCollection fm)
{
if (Command=="CreateNew")
lm = new LocationModel();
lm.location_id = 0;
var GridData = lm.Get_LocationData(lm);//.GetStateData(searchdata);
return View(GridData);
}
please revert thanks in advance...ASAP.:)
推荐答案
这篇关于在mvc4 razor中表单提交时,按钮值不会发布到Controller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!