加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

kendo-ui – 如何使用它的ASP MVC Complete Wrapper设置KendoUI

发布时间:2020-12-16 03:42:04 所属栏目:asp.Net 来源:网络整理
导读:我正在使用KendoUI Grid及其ASP MVC Complete Wrapper库,我在剃刀代码中设置网格高度时出现问题.我尝试设置 HTMLAttribute但似乎不起作用. @(Html.Kendo().GridSoftInn.Data.Country() .Name("grid-countries") .DataSource(datasource = datasource.Ajax()
我正在使用KendoUI Grid及其ASP MVC Complete Wrapper库,我在剃刀代码中设置网格高度时出现问题.我尝试设置 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"})  
  )

解决方法

请尝试以下方法:

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

当前设置不起作用,因为Height不是Kendo Grid正在渲染的DIV元素的有效HTML属性.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读