gpt4 book ai didi

visual-studio - Visual Studio格式不适用于Control + K + D和多行

转载 作者:行者123 更新时间:2023-12-04 04:39:57 25 4
gpt4 key购买 nike

我正在使用Telerik的UI for ASP.NET小部件。这些小部件中的大多数都有多个配置选项。在.cshtml文件中,为了方便阅读,我在多行上配置了这些小部件。
例如,下面是Grid小部件的配置。

<div class="row">
<div class="col-md-12">
@(Html.Kendo().Grid<ResultModel>()
.Name("SearchGrid")
.Columns(col =>
{
col.Bound(p => p.DocumentID);
col.Bound(p => p.UploadDate);
col.Bound(p => p.DocumentType);
col.Bound(p => p.ProcessStatus);
col.Bound(p => p.StateProvince);
col.Bound(p => p.Error);
col.Bound(p => p.Notes);
})
.AutoBind(false)
.Pageable()
.Sortable()
.Resizable(resize => resize.Columns(true))
.Scrollable()
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.MultipleColumn))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(50)
.ServerOperation(true)
.Read(read => read.Action("Search", "Search"))
).Deferred())
</div>
</div>

编辑cshtml文件后,我按 Control + K + D进行自动格式化。 Visual Studio可以正确格式化html以及一行中配置的所有内容。但是,在多行上配置的任何窗口小部件都会被一个选项卡缩进。因此,在上述情况下,从 .Name("SearchGrid")).Deferred()))的所有内容都由一个选项卡缩进。

问题是每次我编辑cshtml时,我按 Control + K + D格式化已编辑的cshtml,但这会使所有其他小部件缩进一个选项卡。最终所有这些小部件都移到页面的最右侧

最佳答案

我找到了解决方案。在多行Kendo Razor的@后面使用{},它不受多个Control + k + d的影响。

@{
(Html.Kendo().DropDownList()
.Name("animatorEntityDropDownList")
.DataTextField("EntityName")
.DataValueField("EntityID")
.OptionLabel("- Select -")
.Events(e =>
{
e.Select("onSelectAnimatorEntityDropDownList");
})
.HtmlAttributes(new { style = "width:300px" }))
}

关于visual-studio - Visual Studio格式不适用于Control + K + D和多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48551570/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com