<i id='KigJX'><tr id='KigJX'><dt id='KigJX'><q id='KigJX'><span id='KigJX'><b id='KigJX'><form id='KigJX'><ins id='KigJX'></ins><ul id='KigJX'></ul><sub id='KigJX'></sub></form><legend id='KigJX'></legend><bdo id='KigJX'><pre id='KigJX'><center id='KigJX'></center></pre></bdo></b><th id='KigJX'></th></span></q></dt></tr></i><div id='KigJX'><tfoot id='KigJX'></tfoot><dl id='KigJX'><fieldset id='KigJX'></fieldset></dl></div>
  • <small id='KigJX'></small><noframes id='KigJX'>

    <tfoot id='KigJX'></tfoot>

      <legend id='KigJX'><style id='KigJX'><dir id='KigJX'><q id='KigJX'></q></dir></style></legend>
        • <bdo id='KigJX'></bdo><ul id='KigJX'></ul>

      1. 使用 Bootstrap Modal 窗口作为 PartialView

        Using Bootstrap Modal window as PartialView(使用 Bootstrap Modal 窗口作为 PartialView)
        <legend id='XLL08'><style id='XLL08'><dir id='XLL08'><q id='XLL08'></q></dir></style></legend>
          <tbody id='XLL08'></tbody>
          <i id='XLL08'><tr id='XLL08'><dt id='XLL08'><q id='XLL08'><span id='XLL08'><b id='XLL08'><form id='XLL08'><ins id='XLL08'></ins><ul id='XLL08'></ul><sub id='XLL08'></sub></form><legend id='XLL08'></legend><bdo id='XLL08'><pre id='XLL08'><center id='XLL08'></center></pre></bdo></b><th id='XLL08'></th></span></q></dt></tr></i><div id='XLL08'><tfoot id='XLL08'></tfoot><dl id='XLL08'><fieldset id='XLL08'></fieldset></dl></div>
        1. <small id='XLL08'></small><noframes id='XLL08'>

            <tfoot id='XLL08'></tfoot>

                • <bdo id='XLL08'></bdo><ul id='XLL08'></ul>

                  本文介绍了使用 Bootstrap Modal 窗口作为 PartialView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我希望使用 Twitter Bootstrap 模态窗口 作为局部视图.但是,我真的不认为它是为这种方式设计的.似乎它是为了以相当静态的方式使用.不过,我认为能够将其用作局部视图会很酷.

                  I was looking to using the Twitter Bootstrap Modal windows as a partial view. However, I do not really think that it was designed to be used in this fashion; it seems like it was meant to be used in a fairly static fashion. Nevertheless, I think it'd be cool to be able to use it as a partial view.

                  例如,假设我有一个游戏列表.单击给定游戏的链接后,我想从服务器请求数据,然后在当前页面顶部"的模式窗口中显示有关该游戏的信息.

                  So for example, let's say I have a list of Games. Upon clicking on a link for a given game, I'd like to request data from the server and then display information about that game in a modal window "over the top of" the present page.

                  我做了一些研究,发现 这篇文章这是相似但不完全相同的.

                  I've done a little bit of research and found this post which is similar but not quite the same.

                  有没有人尝试过这个成功或失败?有人在 jsFiddle 上有一些东西或他们愿意分享的一些资源吗?

                  Has anyone tried this with success or failure? Anyone have something on jsFiddle or some source they'd be willing to share?

                  感谢您的帮助.

                  推荐答案

                  是的,我们已经做到了.

                  Yes we have done this.

                  在您的 Index.cshtml 中,您将拥有类似..的内容.

                  In your Index.cshtml you'll have something like..

                  <div id='gameModal' class='modal hide fade in' data-url='@Url.Action("GetGameListing")'>
                     <div id='gameContainer'>
                     </div>
                  </div>
                  
                  <button id='showGame'>Show Game Listing</button>
                  

                  然后在同一页面的 JS 中(内联或在单独的文件中,您将拥有类似的内容..

                  Then in JS for the same page (inlined or in a separate file you'll have something like this..

                  $(document).ready(function() {
                     $('#showGame').click(function() {
                          var url = $('#gameModal').data('url');
                  
                          $.get(url, function(data) {
                              $('#gameContainer').html(data);
                  
                              $('#gameModal').modal('show');
                          });
                     });
                  });
                  

                  在您的控制器上使用如下所示的方法..

                  With a method on your controller that looks like this..

                  [HttpGet]
                  public ActionResult GetGameListing()
                  {
                     var model = // do whatever you need to get your model
                     return PartialView(model);
                  }
                  

                  您当然需要在 Views 文件夹中创建一个名为 GetGameListing.cshtml 的视图.

                  You will of course need a view called GetGameListing.cshtml inside of your Views folder..

                  这篇关于使用 Bootstrap Modal 窗口作为 PartialView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What are valid deviceNames for Chrome emulation testing with Protractor?(使用 Protractor 进行 Chrome 模拟测试的有效设备名称是什么?)
                  Protractor Check if Element Does Not Exist(量角器检查元素是否不存在)
                  Protractor e2e Tests Login Redirection(Protractor e2e 测试登录重定向)
                  Explain about async/ await in Protractor(解释 Protractor 中的 async/await)
                  Protractor browser.wait doesn#39;t wait(量角器 browser.wait 不等待)
                  How to use Protractor with Angular 2?(如何在 Angular 2 中使用量角器?)
                • <tfoot id='CUIPK'></tfoot>
                    <tbody id='CUIPK'></tbody>
                      <bdo id='CUIPK'></bdo><ul id='CUIPK'></ul>

                      <small id='CUIPK'></small><noframes id='CUIPK'>

                      <legend id='CUIPK'><style id='CUIPK'><dir id='CUIPK'><q id='CUIPK'></q></dir></style></legend>

                        <i id='CUIPK'><tr id='CUIPK'><dt id='CUIPK'><q id='CUIPK'><span id='CUIPK'><b id='CUIPK'><form id='CUIPK'><ins id='CUIPK'></ins><ul id='CUIPK'></ul><sub id='CUIPK'></sub></form><legend id='CUIPK'></legend><bdo id='CUIPK'><pre id='CUIPK'><center id='CUIPK'></center></pre></bdo></b><th id='CUIPK'></th></span></q></dt></tr></i><div id='CUIPK'><tfoot id='CUIPK'></tfoot><dl id='CUIPK'><fieldset id='CUIPK'></fieldset></dl></div>