开发者

ASP.NET MVC Default Button

开发者 https://www.devze.com 2022-12-11 11:39 出处:网络
Can we use it like this... <% using (Html.BeginForm(\"PerformSearch\", \"ClientSearch\", FormMethod.Post, new { defaultbutton = \"btnSearch\" })) %>

Can we use it like this...

<% using (Html.BeginForm("PerformSearch", "ClientSearch", FormMethod.Post, new { defaultbutton = "btnSearch" })) %>

Basically I want the enter key to raise the onClick event of btnSearch. 开发者_开发技巧This button is just a button, not a submit button.


One of the beauties of MVC in .NET is that it lets you easily write your own JavaScript helpers, which what you need to do in this case. Just write a simple function that binds the 'enter' key press to a click event on that button on pageload.

0

精彩评论

暂无评论...
验证码 换一张
取 消