Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kendo ui 如何使用它设置KendoUI网格的高度';s ASP MVC完整包装器_Kendo Ui - Fatal编程技术网

Kendo ui 如何使用它设置KendoUI网格的高度';s ASP MVC完整包装器

Kendo ui 如何使用它设置KendoUI网格的高度';s ASP MVC完整包装器,kendo-ui,Kendo Ui,我正在使用KendoUI网格及其ASP MVC完整包装库,在razor代码中设置网格高度时遇到问题。我尝试设置HTMLAttribute,但似乎不起作用 @(Html.Kendo().Grid<SoftInn.Data.Country>() .Name("grid-countries") .DataSource(datasource => datasource.Ajax() .Model(model

我正在使用KendoUI网格及其ASP MVC完整包装库,在razor代码中设置网格高度时遇到问题。我尝试设置HTMLAttribute,但似乎不起作用

@(Html.Kendo().Grid<SoftInn.Data.Country>()
    .Name("grid-countries")
    .DataSource(datasource => datasource.Ajax()
                                .Model(model => model.Id(record => record.Id))
                                .Create(create => create.Action("Add", "Country"))
                                .Read(read => read.Action("GetAll", "Country"))
                                .Update(update => update.Action("Update", "Country"))
                                .Destroy(delete => delete.Action("Delete", "Country"))
                                .Events(events =>
                                            {
                                                events.Sync("gridcountries_synchandler");
                                                events.Error("gridcountries_errorhandler");
                                            })
                                .PageSize(10)                                   
    )
    .Columns(columns =>
                {
                    columns.Bound(r => r.Name);
                    columns.Bound(r => r.Currency);
                    columns.Bound(r => r.TimeZone);
                    columns.Command(command => { command.Edit(); command.Destroy(); }).Width(170);
                })
    .ToolBar(toolbar =>
                 {
                     toolbar.Create().Text("Add New Country");                            
                     toolbar.Custom().Text("Refresh").Url("#").HtmlAttributes(new { onclick = "window.refreshGrid($(this).parent().parent())", @class = "customRefreshButton" });

                     toolbar.Custom().Text("More").Url("#").HtmlAttributes(new { onclick = "window.toggleDisplay($('#grid-countries > .k-grouping-header'))", @class = "customToggleButton float-right" });                         
                 }
    )
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable(pageable =>
                {
                    pageable.Refresh(true);
                    pageable.PageSizes(true);
                })
    .Resizable(resize => resize.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .Sortable()
    .Scrollable()
    .Filterable()
    .Selectable()
    .ColumnMenu()
    .Groupable()
    .HtmlAttributes(new { Height = "400px"})  
  )
@(Html.Kendo().Grid())
.名称(“电网国家”)
.DataSource(DataSource=>DataSource.Ajax()
.Model(Model=>Model.Id(record=>record.Id))
.Create(Create=>Create.Action(“添加”、“国家”))
.Read(Read=>Read.Action(“GetAll”、“Country”))
.Update(Update=>Update.Action(“更新”、“国家”))
.Destroy(delete=>delete.Action(“删除”、“国家”))
.Events(Events=>
{
events.Sync(“gridcountries\u synchandler”);
错误(“gridcountries_errorhandler”);
})
.页面大小(10)
)
.列(列=>
{
columns.Bound(r=>r.Name);
columns.Bound(r=>r.Currency);
columns.Bound(r=>r.TimeZone);
Command(Command=>{Command.Edit();Command.Destroy();}).Width(170);
})
.ToolBar(ToolBar=>
{
toolbar.Create().Text(“添加新国家”);
toolbar.Custom().Text(“Refresh”).Url(“#”).HtmlAttributes(新的{onclick=“window.refreshGrid($(this.parent().parent())”,@class=“customRefreshButton”});
toolbar.Custom().Text(“More”).Url(“#”).HtmlAttributes(新的{onclick=“window.toggleDisplay($('#网格国家>.k-grouping-header'))”,@class=“customToggleButton float right”});
}
)
.Editable(可编辑=>Editable.Mode(GridEditMode.InLine))
.Pageable(可分页=>
{
pageable.Refresh(true);
页面大小(真);
})
.resize可调整大小(resize=>resize.Columns(true))
.Reorderable(reorder=>reorder.Columns(true))
.Sortable()
.Scrollable()
.可过滤()
.可选()
.column菜单()
.Groupable()
.HtmlAttributes(新的{Height=“400px”})
)
尝试以下操作:

.HtmlAttributes(new { style = "height:400px" })  

当前设置不起作用,因为剑道网格正在渲染的
DIV
元素的
Height
不是有效的HTML属性。

我知道这个问题很老,但它可能会帮助其他人

 .Scrollable(src => src.Height(230))
这也可以解决问题。

查看更多选项: