TSt*_*per 1 c# forms asp.net-mvc
我是源ciew页面中使用BeginForm语法的asp.net-MVC,我被告知如果你想要提交表单,你必须在using语句的末尾有提交Button.我不想使用Button来调用所需的Action我有一个Actionlink设置如下:
<%=Html.ActionLink("" + CreateMore, "Create", "", new { @class = "Create" })%>
Run Code Online (Sandbox Code Playgroud)
并且我希望在单击此actionlink时提交表单,因为他们都要进行相同的操作..而且我不希望能够看到"提交"按钮:
<input type="submit" />
Run Code Online (Sandbox Code Playgroud)
因为链接看起来更好
我会再次转向jQuery来处理这个任务
$(function(){
$('input:submit').hide(); //hide the submit button
$('#submitLinkID').click(function(){ // bind the link's click event
$('input:submit').click(); //click the hidden button
return false; //return false to stop the link from doing anything
});
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6139 次 |
最近记录: |