本文介绍了如何在弹出窗口中创建创建功能,点击保存按钮后想在mvc中继续弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 在asp.net mvc项目中,我使用了三个按钮。当我点击像KOT按钮这样的按钮时,我想要一个弹出窗口。在弹出窗口中想要保存一些数据,如餐厅食品订单信息。点击保存按钮后,弹出窗口不会隐藏,保存的数据将显示在该弹出窗口的右侧。 / *索引视图* / @ Html.ActionLink(KOT, ViewLyubomir,Home,new {id = item.TableNo},new {@class =modal-link btn btn-primary btn-large}) / * LayOut View * /In a asp.net mvc project, I use three button. When i click a button like "KOT" button, i want a pop up window. In pop up window want to save some data like Restaurant food order information. After click save button, pop up window don't hide and that saved data will show in the right side of that pop up window./* Index View */@Html.ActionLink("KOT ", "ViewLyubomir", "Home", new { id = item.TableNo }, new { @class = "modal-link btn btn-primary btn-large" })/* LayOut View */ < script type =text / javascript> $(function(){ //初始化数字微调器输入盒子 // $(。numeric-spinner)。spinedit(); //初始化模态对话框 //将模态容器引导程序属性附加到.modal-link类的链接。 //当使用这些属性单击链接时,bootstrap将在模式对话框中显示href内容。 $('body')。on('click','。modal-link', function(e){ e.preventDefault(true); $(this).attr('data-target',' #modal-container'); $(this).attr('data-toggle','modal'); }); $('body')。on('click','。modal-Imam',function(e){ e.preventDefault(); $(this).attr('data-target','#modal-container'); $(this).attr('data-toggle',' modal'); }); //将监听器附加到.modal-close-btn's,以便在按下按钮时模态对话框消失 $('body')。on('click','。modal-close-btn',functio n(){ $('#modal-container')。modal('hide'); }); //清除模态缓存,以便可以加载新内容 $('#modal-container')。on('hidden.bs.modal',function() { $(this).removeData('bs.modal'); }); $('#CancelModal')。on('click',function(){ return false; }); }) ; < / script> / *KOT局部视图* / 底部我正在使用这个脚本 < script type =text / javascript> $(function(){ $('#approve-btn')。click(function(e){ $('#modal-container')。modal('show'); e.preventDefault(true); }); }); < / script> 我的尝试: 当我点击'KOT'按钮弹出窗口来。但是在点击弹出窗口上的保存按钮后,这将隐藏,我无法阻止这个 <script type="text/javascript"> $(function () { // Initialize numeric spinner input boxes //$(".numeric-spinner").spinedit(); // Initalize modal dialog // attach modal-container bootstrap attributes to links with .modal-link class. // when a link is clicked with these attributes, bootstrap will display the href content in a modal dialog. $('body').on('click', '.modal-link', function (e) { e.preventDefault(true); $(this).attr('data-target', '#modal-container'); $(this).attr('data-toggle', 'modal'); }); $('body').on('click', '.modal-Imam', function (e) { e.preventDefault(); $(this).attr('data-target', '#modal-container'); $(this).attr('data-toggle', 'modal'); }); // Attach listener to .modal-close-btn's so that when the button is pressed the modal dialog disappears $('body').on('click', '.modal-close-btn', function () { $('#modal-container').modal('hide'); }); //clear modal cache, so that new content can be loaded $('#modal-container').on('hidden.bs.modal', function () { $(this).removeData('bs.modal'); }); $('#CancelModal').on('click', function () { return false; }); }); </script>/* "KOT" partial view */On the bottom of KOT i am using this script<script type="text/javascript"> $(function () { $('#approve-btn').click(function (e) { $('#modal-container').modal('show'); e.preventDefault(true); }); });</script>What I have tried:when i click 'KOT' button pop up window come. but after click save button on pop up window, that going to be hide, I can not prevent this推荐答案(function(){ //初始化数字微调器输入框 //(function () { // Initialize numeric spinner input boxes //(。numeric-spinner)。spinedit(); //初始化模态对话框 //将模态容器引导属性附加到.modal-link类的链接。 //当a使用这些属性单击链接,bootstrap将在模式对话框中显示href内容。(".numeric-spinner").spinedit(); // Initalize modal dialog // attach modal-container bootstrap attributes to links with .modal-link class. // when a link is clicked with these attributes, bootstrap will display the href content in a modal dialog.('body')。on('click','。modal-link ',function(e){ e.preventDefault(true);('body').on('click', '.modal-link', function (e) { e.preventDefault(true); 这篇关于如何在弹出窗口中创建创建功能,点击保存按钮后想在mvc中继续弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-30 06:08