小编Rus*_*kwa的帖子

如何在设计时显示 datagridview 行和项目

我想在设计模式/设计时显示 DataGridView 行。有没有办法实现这一目标?

我曾尝试使用此函数:datagridview1.Rows.Add();在控件的构造函数中,但行及其项目仅在runtime中显示。

为什么我需要在显示行及其项目的原因,设计时是我定制的外观DataGridView控件。因此,每次我进行更改,例如更改AlternatingRowColor、RowFont 等时,我都必须运行控件才能查看更改。

这会消耗时间。

如果我可以在设计时/设计模式中显示所有行,那么我将能够在我制作它们时立即看到更改,这将节省大量时间。

我定制的外观DataGridView控件Windows窗体和我使用C#

我不是在代码中定义控件,而是将控件从“控件”选项卡拖放到 Winform 上。

谢谢。

.net c# datagridview windows-forms-designer winforms

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

实体框架核心错误:使用服务器“localhost”上的数据库“”连接时发生错误

我做了一个ASP.NET Core 3.1基于Web的应用程序,想使用MySQL作为数据库。

我一直在关注一些关于使用MySQL database[ASP.NET Core 3.1 代码优先方法]创建的 YouTube 教程,包括来自此网站的教程:

https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/intro?view=aspnetcore-3.1&tabs=visual-studio

我创建了一个,向 Startup.cs 类DataModel Class添加了一个服务,并创建了一个实现.UseMySQLAppDBContext ClassDbContext Class

当我在包管理器控制台中运行此命令时:Add-Migration InitialDatabase应用程序正在成功创建迁移。

当我运行时update-database它抛出此异常:

fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
      An error occurred using the connection to database '' on server 'localhost'.
An error occurred using the connection to database '' on server 'localhost'.
System.InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient …
Run Code Online (Sandbox Code Playgroud)

c# mysql entity-framework-core asp.net-core visual-studio-2019

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

ASP.NET Core 3.1 中的数据表服务器端处理

我是使用 AJAX 调用的数据表的新手。我需要对数千条记录实施服务器端处理。我正在学习教程,但我对服务器端处理感到困惑。

我在尝试从数据源呈现数据时收到错误。让我发布所有相关代码,希望您能帮助我找出哪里出错了。由于我是Datatables和 Ajax 的新手,因此我将欣赏更多带有示例的答案、文本答案以及演示ASP.NET CORE 3.1中服务器端处理的教程的代码或链接。

感谢您的时间和帮助。

注意。我从教程中获取了实现和配置,并尝试对其进行自定义。

下面是 HTML 表格及其模型:

@model IEnumerable<StudentApplications>
<table id="custom-datatable" class="mb-5 display table table-bordered" style="width:100%">
                <thead>
                    <tr>
                        <th>
                            @Html.DisplayNameFor(model => model.ApplicationId)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.Firstname)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.Surname)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.ApplicationFor)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.SubmissionDate)
                        </th>
                        <th></th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th>
                            @Html.DisplayNameFor(model => model.ApplicationId)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.Firstname)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.Surname)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.ApplicationFor)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model …
Run Code Online (Sandbox Code Playgroud)

ajax jquery server-side datatables asp.net-core

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