小编Joh*_*ltz的帖子

MVC5区域无法正常工作

我的MVC 5应用程序中有两个区域无法正常工作。

当我使用以下链接时http://localhost:45970/Admin/Admin,应用会加载正确的index.cshtml whicxh,/Areas/Admin/Views/Admin/Index.cshtml但是当我尝试加载时,http://localhost:45970/Admin它会尝试从加载Index.cshtml文件/Views/Admin/Index.cshtml

所有搜索结果都表明我在做正确的事。我什至已经加载了一个示例API项目,以查看其中的帮助区域,以确保我做的正确。

这是我的RouteConfig.cs文件

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace BlocqueStore_Web
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "BlocqueStore_Web.Controllers" }
            );
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的Global.asax.cs文件的Application_Start()部分

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    GlobalConfiguration.Configure(WebApiConfig.Register);
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}
Run Code Online (Sandbox Code Playgroud)

最后是我的AdminAreaRegistration.cs文件

using …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc asp.net-mvc-areas asp.net-mvc-5

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

如何使用Razor语法将数组从ViewBag转换为JScript数组?

我正在尝试将以下剃刀语法重新编码为可行的代码并且卡住了:

    var ServiceIndex = @ViewBag.ServiceID ;
    var ServiceName = @ViewBag.ServiceName ;
    var ServiceNotes = @ViewBag.ServiceNotes ;
Run Code Online (Sandbox Code Playgroud)

我的问题是,现在这3个数组的ViewBag是空的,所以它在单独的分号上呕吐.

javascript c# arrays asp.net-mvc razor

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

JavaScript Intellisense在Visual Studio 2015中不起作用

我知道在SO以及整个网络上存在各种重复问题.不幸的是,没有任何建议是有效的.除了重新安装VS'15之外,我已经完成了所有事情(如果我可以帮助的话,我不会这样做).

我去过的一个网站:_references.js背后的故事和一个有趣的东西出现(或者说它没有)在选项中的文本编辑器的JavaScript Intellisense部分.对_references.js文件的引用不存在.但是在添加此引用之后,仍然没有智能感知.

有什么办法可以让我的智力回复吗?

javascript intellisense visual-studio javascript-intellisense visual-studio-2015

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

是否可以在jquery中禁用单个单选按钮?

是否可以使用jquery禁用组中的单个单选按钮?

<div id="divAddNewPayrollItemWages" title="Add New Payroll Item">
    <strong>Wages</strong><br />
    Do you want to set up a payroll item to track wages, annual salary, commissions or bonuses?<br />
    <input type="radio" name="rblWages" value="Hourly" />Hourly Wage<br />
    <input type="radio" name="rblWages" value="Annual" />Annual Salary<br />
    <input type="radio" name="rblWages" value="Commission" />Commission<br />
    <input type="radio" name="rblWages" value="Bonus" />Bonus<br /><br />
    <input type="button" value="Back" disabled="disabled" />&nbsp;&nbsp;
    <input type="button" value="Next" onclick="AddNewPayrollItemWages_Next();" />&nbsp;&nbsp;
    <input type="button" value="Finish" disabled="disabled" />&nbsp;&nbsp;
    <input type="button" value="Cancel" onclick="AddNewPayrollItemWages_Cancel();" />
</div>
<div id="divAddNewPayrollItemHourlyWages" title="Add New Payroll …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

我的解决方案在哪里永久禁用延迟加载?

我知道基于MSDN的几篇文章你只需添加:

this.Configuration.LazyLoadingEnabled = false;
this.Configuration.ProxyCreationEnabled = false;
Run Code Online (Sandbox Code Playgroud)

在EDMX文件附带的context.cs文件中或编辑context.tt文件,以便在重新生成edmx文件时添加这些行.

但是,我注意到当数据库字段发生更改(特别是删除它们),并且替换了ADO.NET文件时,必须重新创建更改.当我必须重新创建ADO.NET文件时,是否有可以永久添加要包含在我的context.cs文件中的行?

我确实注意到关于SO的这篇文章接近这个问题,但没有附近的地方:

默认情况下,在Entity Framework 4中禁用延迟加载

c# entity-framework

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