小编mis*_*rop的帖子

使用 ASP.NET Core 2.0 MVC 在一个解决方案的不同项目中共享相同的 _layout.cshtml

我们正在开发具有不同功能的多个内联网网站。我们计划有一个根项目(具有一些基本功能),用户可以从中导航到不同的其他项目。我们计划所有此类项目都应使用相同的 Layout _Layout.cshtml。为了实现这一点,我们尝试_Layout.cshtml将“side-projects”链接到根项目。我们使用了 VS 内置链接方法,如下所述:https : //stackoverflow.com/a/19862471/9641435 该文件链接到路径,没有任何错误消息/Views/Shared/_Layout.cshtml。但是,如果我们启动站点项目之一,则会出现以下错误消息:

处理请求时发生未处理的异常。

InvalidOperationException: 无法找到布局视图“_Layout”。搜索了以下位置:/Views/Home/_Layout.cshtml /Views/Shared/_Layout.cshtml

Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, string executionFilePath, string layoutPath)

异常堆栈:

InvalidOperationException: 无法找到布局视图“_Layout”。搜索了以下位置:/Views/Home/_Layout.cshtml /Views/Shared/_Layout.cshtml

Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, string executionFilePath, string layoutPath)

Microsoft.AspNetCore.Mvc.Razor.RazorView+d__18.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

Microsoft.AspNetCore.Mvc.Razor.RazorView+d__14.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor+d__22.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor+d__21.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

Microsoft.AspNetCore.Mvc.ViewResult+d__26.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__19.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__24.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)

Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)

Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__22.MoveNext()

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)

Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object …

asp.net-mvc share asp.net-core visual-studio-2017 asp.net-core-2.0

7
推荐指数
1
解决办法
1083
查看次数

如何在jquery数据表中隐藏第一页的上一页和最后一页的下一页

我使用 jquery 库来显示 sql 结果。在数据表的第一页上,默认情况下前一个按钮处于禁用状态。但是我希望它被隐藏,最后一页上的下一个按钮也是如此。

由于它被自动停用,我在想可能有一个参数或某物来隐藏它,但是我在研究过程中并没有发现太多。

我的桌子看起来像这样:

    $('#userTable').DataTable();    
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.css"/> 
<script src="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.js"></script>

<table id="userTable">
  <thead>
    <tr>
    <th>heading1</th>
    <th>heading2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
    <td>element11</td>
    <td>element12</td>
    </tr>
    <tr>
    <td>element21</td>
    <td>element22</td>
    </tr>
    <tr>
    <td>element31</td>
    <td>element32</td>
    </tr>
    <tr>
    <td>elementN1</td>
    <td>elementN2</td>
    </tr>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

datatable jquery pagination

1
推荐指数
1
解决办法
2013
查看次数