c# - 在 Razor 应用程序中将 View 显示为灯箱

标签 c# javascript jquery asp.net-mvc razor

我有一个带有 razor 的 asp.net mvc4 应用程序。

View.Cshtml

<table>
    <tr>
        <th>
          Concept technologique
        </th>
        <th></th>
    </tr>
    @foreach(Features_Management.Models.First_Attempt fa in Model)
    {
        <tr style="font-size: 12px; padding:0px;">
            <td>
                  @Html.Raw(@fa.Concept)
            </td>
            <td> 
                @Html.ActionLink("Donner votre avis","", new { id_element =  @fa.Id_element})
            </td>
        </tr>
    }
</table>

当我点击 ActionLink 时,我需要在 Lightbox 中显示相同的 View 。

我该怎么做?有什么建议吗?

最佳答案

您可以使用FancyBox (灯箱的替代品)

将其添加到页面(.cshtml)

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery
                                     /1.4/jquery.min.js"></script>

 <script type="text/javascript" src="/scripts/jquery.fancybox-1.3.4.pack.js"></script>

 <link rel="stylesheet" href="/css/jquery.fancybox-1.3.4.css" type="text/css"
  media="screen" />

MVC 帮助程序代码

 @Html.ActionLink("Donner votre avis","", new { id_element =  @fa.Id_element,
    @class='iframe'})

JS

$(document).ready(function() {
  $('a.iframe).fancybox();    
}

Read more

关于c# - 在 Razor 应用程序中将 View 显示为灯箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19543739/

相关文章:

c# - 如何根据类型列表检查对象的类型?

javascript - 使用 Highcharts 将条形图显示为箭头

javascript - 将 div 向下滑动到页面中间

javascript - 将字符串中的重复字符减少到给定的最小值

javascript - 我如何将它从 jQuery 移植到 AngularJS

javascript - 基于 HREF 的 Div 的非常简单的 .toggleClass

javascript - 使用 Highcharts 并在没有数据时在图表上方或上方显示消息

c# - 仅接受从特定服务器到我的 asp.net 页面的请求

javascript - 如何使用 javascript/jQuery 检查所有 ASP CheckBoxList 项目

c# - 用 ASP .NET 重写 HTTP 方法