MVC和按钮不起作用 [英] MVC and buttons not working

查看:80
本文介绍了MVC和按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我是MVC的新手,所以如果这听起来像一个愚蠢的问题,请原谅我:

我正在使用Razor使用VS2010和MVC4随附的模板来构建应用程序.我的问题是按钮...我尝试过

Hi guys

I''m new to MVC, so forgive me if this sounds like a silly question:

I am building an application using the template that comes with VS2010 and MVC4 using Razor. My problem is buttons... I have tried

<input type="submit" name="value" value="value" />
<button type="submit" name="value" value="value">Test</button>



但是这些都不起作用.没有回发屏幕刷新或任何其他操作.

谁能告诉我我想念的东西吗?似乎应该这么简单,但是我正在为此撕头发...

据我所知,应该没有什么可以禁用这些功能.

谢谢



but neither of these do anything. No postback screen refresh or anything.

Can anyone tell me what I am missing? It seems like it should be so simple, yet I''m tearing my hair out over this...

As far as I am aware, there should be nothing that would disable these.

Thanks

推荐答案

如果您从未向按钮事件添加任何处理程序,它将如何工作?您可能使用的所有内容最终都基于按钮onclick属性和JavaScript:
http://www.w3schools.com/jsref/event_onclick.asp [
How would it works if you never added any handlers to the button events? Everything you can possibly use is ultimately based on button onclick attribute and JavaScript:
http://www.w3schools.com/jsref/event_onclick.asp[^].

—SA


这篇关于MVC和按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆