小编Jah*_*han的帖子

发布后,我的Umbraco管理面板没有在IE9中显示.但它出现在FF和Chrome浏览器中

发布后,我的Umbraco管理面板没有在IE9中显示.但它出现在FF和Chrome浏览器中.

注意:在发布网站之前,我从Visual Studio 2012运行它,我发现一切都很好.

谁能帮我?

在IE9中 在Firefox中

asp.net umbraco publishing-site web

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

asp.net Core 2 中的 AddOrUpdate() 方法

使用时如何访问AddOrUpdate()方法ASP.NET Core 2

AddOrUpdate()EntityFramework 6System.Data.Entity.Migrations命名空间。但是当我想在 中使用这种方法时ASP.NET Core 2,我找不到它。

entity-framework entity-framework-core asp.net-core-2.0

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

运行所选代码生成器时发生错误:无法加载文件或程序集Microsoft.EntityFrameworkCore,版本= 2.0.1.0

当我创建ControllerView通过MVC Controller with views, using Entity Framework我得到了一个错误。

错误是:

运行所选代码生成器时发生错误:“无法加载文件或程序集Microsoft.EntityFrameworkCore,版本= 2.0.1.0,Culture = neutral,PublicKeyToken = adb9793829ddae60”,找到的程序集的清单定义与程序集引用不匹配 错误图片

使用实体框架创建带有视图的MVC Controller: 使用实体框架创建带有视图的MVC Controller

我怎么解决这个问题?

我使用的Visual Studio Version 15.5.2版本Microsoft.AspNetCore.All2.0.0

asp.net-mvc-scaffolding asp.net-core-mvc asp.net-core asp.net-core-2.0

6
推荐指数
2
解决办法
5792
查看次数

在cshtml文件中的C#块代码之间插入html标记

我想在C#块代码之间使用html标签,我试过但是我遇到了错误.如何在cshtml文件中的C#块代码之间插入html标签?

错误是:

只有赋值调用增量递减和新对象表达式才能用作语句

只有赋值调用增量减量等待,新对象表达式可以用作语句 在此输入图像描述

@{
    Func<List<Comment>, Comment, HelperResult> ShowTree = null;
    ShowTree = (items, node) =>
    {
        @<text>
            <ul>
                @foreach (var comment in items)
                {

                }
            </ul>
         </text>;
        return null;
    };

}
Run Code Online (Sandbox Code Playgroud)

更新:当我将文本移到{}之外时,我也遇到了一些错误.看这张图片. 在此输入图像描述

更新2: 我已经使用@:但仍有问题.那是;expected

我怎么解决这个问题?

在此输入图像描述

@{
Func<List<Comment>, Comment, int, HelperResult> ShowTree = null;
ShowTree = (items, parentItem, parentId) =>
{
    var count = items.Count(p => p.ParentId == parentId);
    if (count > 0)
    {
        @:<ul>
            foreach (var item in items.Where(p => p.ParentId == 
 parentId).ToList())
            {
            @:<li>
                string …
Run Code Online (Sandbox Code Playgroud)

razor asp.net-core-mvc asp.net-core asp.net-core-2.0 razor-pages

6
推荐指数
2
解决办法
3854
查看次数

将 CSS 文件添加到 SelectPdf 转换器

如何向 SelectPdf 转换器添加/引入 CSS 文件?

我使用SelectPdf库将 HTML 字符串转换为 PDF 文件。

我的 CSS 文件位于cssFilePath

public byte[] Create(string htmlString)
{
   string cssFilePath = Path.Combine(Directory.GetCurrentDirectory(), "assets", "PruefReportDataTableFormat.css");

        string pdf_page_size = "A4";
        PdfPageSize pageSize = (PdfPageSize)Enum.Parse(typeof(PdfPageSize), pdf_page_size, true);

        string pdf_orientation = "Portrait";
        PdfPageOrientation pdfOrientation = (PdfPageOrientation)Enum.Parse(typeof(PdfPageOrientation), pdf_orientation, true);

        int webPageWidth = 1024;
        int webPageHeight = 0;

        HtmlToPdf converter = new HtmlToPdf();

        converter.Options.PdfPageSize = pageSize;
        converter.Options.PdfPageOrientation = pdfOrientation;
        converter.Options.WebPageWidth = webPageWidth;
        converter.Options.WebPageHeight = webPageHeight;

        PdfDocument doc = converter.ConvertHtmlString(htmlString);
        byte[] result = doc.Save(); …
Run Code Online (Sandbox Code Playgroud)

c# converters html-to-pdf selectpdf

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

当我应用 TinyMCE 时,如何使 textarea 强制提交

我想在应用 TinyMCE 时强制提交文本区域。

如果我给 加上required属性<textarea>,会导致即使填了也无法提交!

我怎么解决这个问题?

tinymce.init({
    selector: '#summaryId',
    max_chars: 255, // max. allowed chars
    plugins: "paste",
    setup: function (ed) {
        var allowedKeys = [8, 37, 38, 39, 40, 46]; // backspace, delete and cursor keys
        ed.on('keydown', function (e) {
            if (allowedKeys.indexOf(e.keyCode) != -1) return true;
            if (tinymce_getContentLength() + 1 > this.settings.max_chars) {
                e.preventDefault();
                e.stopPropagation();
                return false;
            }
            return true;
        });
        ed.on('keyup', function (e) {
            tinymce_updateCharCounter(this, tinymce_getContentLength());
        });
    },
    init_instance_callback: function () { // initialize counter …
Run Code Online (Sandbox Code Playgroud)

html javascript tinymce form-submit

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

“MySQLDbContextOptionsBuilder”不包含“ServerVersion”的定义

我在我的项目中应用了 ASP.NET Core 3.1,我想通过代码优先的方法创建数据库并使用 MySQL。在 startup.cs 文件中,我收到此错误:

CS1061“MySQLDbContextOptionsBuilder”不包含“ServerVersion”的定义,并且没有可访问的扩展方法“ServerVersion”接受“MySQLDbContextOptionsBuilder”类型的第一个参数

我该如何解决?

在startup.cs中:

using Microsoft.EntityFrameworkCore;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;

public void ConfigureServices(IServiceCollection services)
{
   services.AddDbContextPool<Alpha.Web.App.ApplicationDbContext>(options =>
            options.UseMySQL(Configuration["ConnectionStrings:DefaultConnection"],
            mysqlOptions =>
            {
                mysqlOptions.ServerVersion(new Version(8, 0, 20), ServerType.MySql);
            }));
} 
Run Code Online (Sandbox Code Playgroud)

dbcontext entity-framework-core asp.net-core asp.net-core-3.0

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

ASP.NET Core 2 中 HttpContext.Current.Items.Contains(DataContextKey) 的替代方案

我想将一些代码升级到ASP.NET Core 2. 我知道HttpContext.Current已从 中删除ASP.NET Core 2并且必须使用IHttpContextAccessor.

但我不知道应该如何替换这段代码:

HttpContext.Current.Items.Contains(DataContextKey)

我该怎么做?

完整代码:

namespace Jahan.Infrastructure.DataAccess.DataContextStorage
{
    public class HttpDataContextStorageContainer<T> : IDataContextStorageContainer<T> where T : class
    {
        private const string DataContextKey = "DataContext";

        public T GetDataContext()
        {
            T objectContext = null;
            if (HttpContext.Current.Items.Contains(DataContextKey))
            {
                objectContext = (T)HttpContext.Current.Items[DataContextKey];
            }
            return objectContext;
        }

        public void Clear()
        {
            if (HttpContext.Current.Items.Contains(DataContextKey))
            {
                HttpContext.Current.Items[DataContextKey] = null;
            }
        }

        public void Store(T objectContext)
        {
            if (HttpContext.Current.Items.Contains(DataContextKey))
            {
                HttpContext.Current.Items[DataContextKey] = objectContext;
            } …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core-mvc asp.net-core asp.net-core-2.0

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

在Asp.Net Core 2中是否有与Response.Redirect(“〜/ Controller /”)等效的东西?

有相当于Response.Redirect("~/Controller/")in Asp.Net Core 2吗?

我不想用ViewComponent。相反,我想从视图中调用Controller和action方法。

@using Jahan.Blog.Web.Mvc.Models
@{
    ViewBag.Title = "Home Page";
}

<header>
    <h1> Blog </h1>
</header>
<div class="blog-description">
    <p>...</p>
</div>

@{ Response.Redirect("~/Article/");}
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-core asp.net-core-2.0 razor-pages

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

在 EF Core 2 中的自引用表中实现级联删除

如何在 EF Core 2 中的自引用表中实现级联删除(代码优先)?

(例如,有一个评论表,一个人可以回复一条评论,这个回复可以由另一个人回复。)

public class Comment
{
    public virtual int Id { get; set; }
    public virtual int? ParentId { get; set; }
    public Comment Parent { get; set; }
    public virtual IList<Comment> Replies { get; set; }
    public virtual string Description { get; set; }
    public virtual Article Article { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

entity-framework cascade entity-framework-core ef-core-2.0 entity-framework-migrations

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