2016-04-30 47 views
0

就像我在标题中所说的,我想要做的是:当我点击一个链接时在弹出框中显示一个视图! 我已经在弹出窗口中显示了一些文字,但是我现在没有如何在弹出窗口中显示一个视图! 代码:如何在弹出框中显示视图

@{ 
 
    ViewBag.Title = "Index"; 
 
    Layout = "~/Views/Shared/_Layout.cshtml"; 
 
} 
 

 
<h2>Create popup</h2> 
 
<input onclick="showPopup()" type="button" value="Click"/> 
 
<div id="divContaiPopup" class="table-responsive" style="display:none;"> 
 
    <div> 
 
     <table class="table table-striped table-hover3"> 
 
      <tr> 
 
       <td>hi</td> 
 
       <td>hello</td> 
 
      </tr> 
 
     </table> 
 
    </div> 
 
</div> 
 
<script type="text/javascript"> 
 
    function showPopup() { 
 
     $("#divContaiPopup").dialog({ 
 
      height:400, 
 
      width:500, 
 
      modal:true, 
 
      buttons:{ 
 
       "OK":function(){ 
 
        $(this).dialog("close"); 
 
        aert('you selected ok!!') 
 
       }, 
 
       "Cancel":function(){ 
 
        $(this).dialog("close"); 
 
       } 
 
      } 
 
     } 
 
     ); 
 
       } 
 
    
 
</script>

脚本:

<script src="~/Scripts/jquery-1.7.1.js"></script> 
 
<script src="~/Scripts/jquery-ui-1.8.20.js"></script> 
 
    

回答

0

试试这个

function showPopup() { 
      $(document).ready(function() { 
        $("#divContaiPopup").dialog({ 
         height:400, 
         width:500, 
         modal:true, 
         buttons:{ 
          "OK":function(){ 
           $(this).dialog("close"); 
           aert('you selected ok!!') 
          }, 
          "Cancel":function(){ 
           $(this).dialog("close"); 
          } 
         } 
        } 
        ); 
      }); 
     } 

脚本: -

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script> 

或者

入住这Link

+0

感谢回答我,我已经做到了这一点,它的工作原理,但我的问题是如何显示“视图“(MVC),通过调用控制器中的动作,而不仅仅是存在于同一页面中的'div'的内容! – KaoutarStack