asp.net 相关问题

ASP.NET是一个Microsoft Web应用程序开发框架,允许程序员构建动态Web站点,Web应用程序和Web服务。将此标记与项目类型标记结合使用非常有用,例如[asp.net-mvc],[asp.net-webforms]或[asp.net-web-api]。不要将此标记用于有关ASP.NET Core的问题 - 请改用[asp.net-core]。

package dotnet框架和Dotnet核心之间的冲突

我在同一个解决方案文件中有一个 .NET Framework 和一个 .NET Core 项目。我在这两个项目中都使用了 SQLite 和 Newtonsoft.Json 等软件包。然而,在构建解决方案时,包...

回答 1 投票 0

根据 AngularJS 中 JSON 输入的下拉选择绑定数据

我正在尝试根据下拉列表的下拉选择来过滤数据。这里我将从 JSON 输入中获取数据。 在提交日期中,我选择了 06/30/2022,所以对于这个 d...

回答 1 投票 0

使用 JsonResult 返回时 JSON 对象会序列化为空括号

我正在使用 ASP.NET MVC 5 在 .NET Framework 中进行操作。我有一个 MVC 控制器,它使用 Newtonsoft.Json(或 json.net)来构建一个漂亮的 JSON 对象。我遇到的麻烦是当我

回答 2 投票 0

如何在JsonResult中返回Jtoken

请告诉我。如何将此数据返回到 JsonResult 中?我花了2小时也想不出来。 我的任务: 我需要获取这些数据,将其返回到 JsonResult 并在 ajax 中处理它。我会很高兴...

回答 2 投票 0

如何通过 ASP.NET MVC 中的迁移在 OnModelCreating() 中创建一个或多个用户?

假设我有一个标准的 WebApplication 将数据保存到远程数据库。通过逻辑分离,我有一个 DataAccess 类,它当前正在初始化一组自定义角色

回答 1 投票 0

如何使用 C# 中的 Graph API 更新用户个人资料图像

我想使用 C# 中的 Graph API 更新我的用户个人资料图像和另一个用户的个人资料图像。 我拥有 Microsoft Azure 中使用代码执行任何操作的所有权限。 怎么可能。 请建议...

回答 1 投票 0

不使用 PublishProfile 发布 ASP.NET MVC 项目

我想使用 msbuild 通过命令提示符发布我的 ASP.NET MVC 项目。 当我使用publishProfile时,它工作正常并在所需位置生成发布文件夹;但当我使用

回答 1 投票 0

在 .NET 依赖注入中解析服务时如何注入运行时参数?

我有一个存储库类,它有一个使用文件系统的实现。 存储库抽象 公共接口IPersonRepository { IEnumerable GetAll(); ...

回答 1 投票 0

如何在 PDFsharp 中垂直向下移动内容?

我正在使用 PDFsharp 库创建 PDF 文档。我可以在多个页面上创建页眉和页脚,但是我的页眉和页脚与我的主要内容重叠。 这是基本代码

回答 1 投票 0

在服务器上加载页面时,Visual Studio 发布的网站出现错误“类型‘JObject’未定义”

这适用于 Visual Studio。 它不适用于运行 IIS 10 的 Windows 2016 Server Core。 发布后,没有任何问题。 在服务器上运行网站,我收到错误 Type 'JObject' is not

回答 1 投票 0

如何动态设置div高度值?

我有一个 HTML 页面,包含 3 个 div,如下所示: 关联 我有一个 HTML 页面,包含 3 个 div,如下所示: 链接 <div style="min-height:100%;"> <div id="TopContent" style="display: inline-block; height: 100px; width: 100%; background-color: #CCDEBB;"> </div> <div id="LeftContent" style="display: inline-block; width: 25%; border: 3px solid #DFE8F6;"> </div> <div id="RightContent" style="border: 3px solid #b8cfee; display: inline-block; float: right; width: 72%;"> </div> </div> 我想根据页面高度值设置LeftContent和RightContent的高度值。我的意思是 LeftContent 和 RightContent 高度延伸到页面末尾。 使用 calc(); #LeftContent{ float:left; margin-right:3px; height:calc(100% - 100px); //-100px because height of top bar is 100px } 正确内容也一样 您无法使用此 HTML 控制高度,但您可以使用 :before/:after 元素来模拟此效果: #LeftContent:after, #RightContent:after{ content:''; position:absolute; top:0; left:0; width:100%; height:9999px; z-index:-1; background:#DFE8F6; } #RightContent:after{background:#b8cfee;} http://jsfiddle.net/EhnhZ/ 我建议你使用classes而不是id。 HTML <div class="content top"></div> <div class="content left"></div> <div class="content right"></div> CSS *{ height:100%; width:100%; margin:0; } /* instead of HTML and BODY attributes */ .content{ display:inline-block; margin-right:-4px; /*to margin left div with the right one!*/ margin-top:-4px; /*to margin left and right divs with the top one!*/ } .left{ height:calc(100% - 200px); /*use calc(100% - "top div height" */ width:50%; /*choose your own width*/ background-color:red; } .right { height: calc(100% - 200px); /*use calc(100% - "top div height" */ width:50%; /*choose your own width*/ background-color:green; } .top{ width:100%; height:200px; background-color:blue; } 希望这可以帮助你! (更多信息请参见 http://codepen.io/utopy/pen/zcyti ) 喜欢这个演示吗? 只需将 float: left; 添加到 LeftContent 我使用这个问题的答案构建了我的答案 <style> html, body { margin: 0; padding: 0; height: 100%; } </style> <div style="min-height:100%;height:100%;"> <div id="TopContent" style="height: 100px; width: 100%; background-color: #CCDEBB;"> </div> <div id="LeftContent" style="min-height:100%;width: 25%; border: 3px solid #DFE8F6;float:left"> </div> <div id="RightContent" style="min-height:100%;border: 3px solid #b8cfee; width:72%;float:right"> </div> </div> 目前您的解决方案将无法工作,这是因为网页documents的渲染方式不同。 目前,您当前的 HTML 文档的高度如下: 100px (from TopContent) + 3px (from LeftContent) + 3px (from RightContent) 因为 document 不需要大于 106px(基于内容),所以 document 元素不会渲染得超过这个值。 你可以通过将 body/html CSS 属性设置为 100% 的高度来解决这个问题。 使用以下 CSS 来执行此操作: body,html { height:100%; } 此外,您还需要将容器 div 的高度设置为 <div style="height:100%;"> 这是您的问题的示例 JSFiddle。 你应该使用jquery,在这个事件中设置div的高度 $(window).resize(function () { $('#LeftContent').css('height',$(window).height()); $('#RightContent').css('height',$(window).height()); });

回答 7 投票 0

为什么我的 CommandArgument='<%# Eval("ID") %>' 为空

我的文件.aspx 我的文件.aspx <td rowspan="2" class="btn" > <asp:HiddenField id="hdnID" value='<%# Eval("ID") %>' runat="server" /> <asp:Button ID="BtnAnswer" runat="server" Text="Answer" EnableViewState="false" CssClass="answer-button" CommandName="OpenPage" CommandArgument='<%# Eval("ID") %>' CausesValidation="false" /> </td> 我检查我的 hdnID 是否有价值 ='2'。但在代码中=''. 我的文件.cs protected void listView_ItemCommad(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "OpenPage") { string id = (e.CommandArgument).ToString(); Response.Redirect("GoIkenHenshuuGamen.aspx?id=" + id); } } 我曾经做过类似的事情,然后这样做了: int ID = int.Parse(((LinkButton)e.CommandSource).CommandArgument); 尝试一下,将 LinkButton 更改为 Button。也删除 int.Parse。

回答 1 投票 0

等待任务中的事件回调将退出执行代码

我有一个父 Razor 组件和一个子 Razor 组件,子组件有一个 EventCallback 类型的参数。如果我在等待 .

回答 1 投票 0

为什么 Visual Studio 2022 工具箱中不包含 datatimepicker 控件?

我不想使用 C# 在 ASP.NET Web 应用程序中显示整个日历。 我尝试像在早期版本的 Visual Studio 中一样安装 datetimepicker,但没有成功。怎么...

回答 1 投票 0

在 ASP.NET 应用程序中编辑/删除导航栏

有没有一种简单的方法可以编辑或删除使用 Twitter Bootstrap 的 ASP.NET 应用程序顶部的导航栏? 需要删除“注册”和“登录”链接,并且“申请N...

回答 2 投票 0

将数据表合并为具有条件 asp.net Web API 的 JSON 数组

我有两个数据表 数据表 dt1 和 数据表 dt2. dt1 充满产品,dt2 充满产品口味。 两个表都有一个共同的 ID,即产品代码。 使用 newtonsoft JSON

回答 1 投票 0

命名空间“System”中不存在“ServiceModel”。当我尝试添加引用时,它说它已被引用

我正在使用 Visual Studio Professional 2013,并且我正在尝试导入文件位于 SVN 上的 ASP.NET 网站,以便我可以在本地运行和调试该网站。我创建了一个新网站并更改了...

回答 4 投票 0

从 HttpContext 读取 DTO 在 JSON 反序列化中返回 null(nswag 生成的客户端)

我正在深入研究 NET8、最小的 API 和干净的架构。 首先:这有效(Swagger UI 和邮递员) app.MapPost("/user/login", async (HttpContext httpContext, [FromBody] LoginDto

回答 1 投票 0

验证过程中检测到以下错误。 - 无法反序列化当前 JSON 对象(例如 {"name":"value"})

我有 asp.net core mvc 视图,我在 foreach 中显示输入值 这是查看代码 我有 asp.net core mvc 视图,我在其中显示输入值 foreach 这是查看代码 <div class="modal-body box-wrap"> <form role="form" novalidate class="form-validation" name="ServicePriceInformationsForm"> <input type="hidden" asp-for="Id" /> <input type="hidden" asp-for="ServiceId" /> <div class="form-group"> <label class="required-label">@L("Location")</label> <select class="form-control" required asp-for="LocationId"> <option value="">@L("SelectALocation")</option> @if (Model.LocationId.HasValue) { <option selected value="@Model.LocationId">@Model.LocationName</option> } </select> </div> <div class="form-group"> <label class="required-label">@L("MaterialUom")</label> <select class="form-control" asp-for="MaterialUomId" id="ServicePrice_MaterialUomId"> <option value="">Select an option</option> @if (Model.MaterialUomId > 0) { <option value="@Model.MaterialUomId">@Model.MaterialUomName</option> } </select> </div> <div class="form-group"> <label>@L("Cost")</label> <input class="form-control" type="text" asp-for="Cost" data-rule-number="true" data-rule-min="0" data-rule-max="@AppConsts.MaxDecimalDatabaseLength"> </div> @{ int i = 0; } @foreach (var tier in @Model.LocationServicePrices) { <div class="form-group"> <label>@tier.PricingTierName</label> <input class="form-control" type="text" asp-for="@tier.PricePerUnit" name="LocationServicePrices[@i].PricePerUnit" data-rule-number="true" data-rule-min="0" data-rule-max="@AppConsts.MaxDecimalDatabaseLength"> </div> i++; } </form> </div> 然后在JS中我像这样将数据传递给BE this.save = function() { if (!_$form.valid()) { _$form.showValidateMessage(); return; } var servicePrice = _$form.serializeFormToObject(); console.log(servicePrice); _modalManager.setBusy(true); _serviceService.editLocationService(servicePrice).done(function() { abp.notify.info('Saved successfully.'); _modalManager.close(); abp.event.trigger('app.createOrEditServicePriceModalSaved'); }).always(function() { _modalManager.setBusy(false); }); }; 浏览器中的控制台显示此 这是BE的模型 public class LocationServiceEditDto: EntityDto<int?> { public int ServiceId { get; set; } public int? LocationId { get; set; } public decimal? Cost { get; set; } public int? MaterialUomId { get; set; } public string MaterialUomName { get; set; } public string LocationName => Location?.Name; [JsonIgnore] public LocationNameDto Location { get; set; } public ICollection<LocationServicePriceDto> LocationServicePrices { get; set; } } 这是控制器 public async Task EditLocationService(LocationServiceEditDto input) { var locationServices = new List<LocationServicePrice>(); if (input.LocationServicePrices.Count > 0) { locationServices = input.LocationServicePrices.Select(x => new LocationServicePrice() { LocationServiceId = x.LocationServiceId, PricingTierId = x.PricingTierId, PricePerUnit = x.PricePerUnit }).ToList(); } await _locationServiceRepository.InsertOrUpdateAndGetIdAsync(new LocationService { Id = input.Id ?? 0, ServiceId = input.ServiceId, LocationId = input.LocationId, Cost = input.Cost, UnitOfMeasureId = input.MaterialUomId, LocationServicePrices = locationServices }); } 生成的JSON是: { "Id": "", "ServiceId": "2031", "LocationId": "2", "MaterialUomId": "6", "Cost": "123", "LocationServicePrices": { "0.PricePerUnit": "1", "1.PricePerUnit": "2", "2.PricePerUnit": "3", "3.PricePerUnit": "4", "4.PricePerUnit": "5" } } 当我单击“保存”时,出现此错误 我该如何解决这个问题? 问题出在序列化上。 一个简单的解决方法是将对象设置为像这样的数组。 var servicePrice = _$form.serializeFormToObject(); servicePrice.LocationServicePrices = Object.values(servicePrice.LocationServicePrices) .map(elm => +elm); console.log(servicePrice); P.S:基于假设 LocationServicePrices 需要一个 int 数组(来自错误消息的屏幕截图)。

回答 1 投票 0

如何使用 IValidatableObject?

我知道 IValidatableObject 用于以一种可以相互比较属性的方式验证对象。 我仍然希望有属性来验证各个属性,...

回答 9 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.