将 jQuery 对话框附加到 ASP.NET-MVC 中的“提交”按钮
我有一个提交按钮,它一直在 ASP.NET-MVC 中提交我的表单。
我想将 jQuery 对话框附加到按钮单击。如果用户退出对话框,那么我也想退出提交。
我有对话框连接到其他按钮,但没有提交。我该怎么做?
****编辑****
这是我在另一个按钮上的对话框的示例。
<button type="button" id="create-company" >Create Company</button>
<div id="popupCreateService_Line" title="Create a new service line">
<fieldset>
<label for="service_line_name">Name:</label>
<%= Html.TextBox("service_line_name") %>
<label for="service_line_desc">Desc:</label>
<%= Html.TextBox("service_line_desc") %>
</fieldset>
</div>
$("#create-service_line").click(function() {
$('#popupCreateService_Line').dialog('open');
});
I have a submit button which has been working to submit my form in ASP.NET-MVC.
I would like to attach a jQuery dialog to the button click. If the user exits out of the dialog, then I would like to exit from the submit as well.
I have dialogs hooked to other buttons, but not submits. How can I do this?
****EDITED****
This is an example of the dialog I have on another button.
<button type="button" id="create-company" >Create Company</button>
<div id="popupCreateService_Line" title="Create a new service line">
<fieldset>
<label for="service_line_name">Name:</label>
<%= Html.TextBox("service_line_name") %>
<label for="service_line_desc">Desc:</label>
<%= Html.TextBox("service_line_desc") %>
</fieldset>
</div>
$("#create-service_line").click(function() {
$('#popupCreateService_Line').dialog('open');
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将其附加到您的表单加载事件。
添加这两个函数:
将其添加到您的表单加载以进行保存:
hth :)
attach this to your form load event..
add these two functions:
add this to your form load for the save:
hth :)
通过对话框,我不确定您是指某些自定义 css 对话框还是 javascript 中的确认对话框。对于后者,这段代码应该可以正常工作。
By dialog im not sure if you are referring to some custom css dialog or a confirm dialog in javascript. For the latter this code should work just fine.