我的MVC应用程序中有一个可选的KendoUI网格.我想在用户双击网格时执行某些操作.
我没有看到网格的双击事件.
当没有暴露时,我如何处理双击事件?
我在asp.net mvc中使用kendo Ui为create Grid编写此代码
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Id).Groupable(false).Visible(false);
columns.Bound(p => p.BrandName);
columns.Bound(p => p.BrandAbbr);
columns.Bound(p => p.SrcImage);
columns.Command(command => command.Custom("ViewDetails").Click("showDetails"));
})
.ToolBar(toolbar =>
{
toolbar.Custom().Action("Create","Users").Text("add");
}
)
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new {style = "height:500px;"})
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Multiple)
.Type(GridSelectionType.Row))
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(item => item.Id))
))
Run Code Online (Sandbox Code Playgroud)
我想当用户点击ViewDetails警报BrandId值栏时,请帮助我.谢谢所有
我有一个剑道网格.当页面加载时,默认情况下我想按列1对网格进行排序,然后按列降序排序.
问题: 按预期排序,但排序箭头显示在最后排序的列上.因此,在下面的情况下,当页面加载时,排序箭头位于"DueDate"而不是"DownloadDate"
@(Html.Kendo().Grid<TrackingVM>()
.Name("Grid")
.Columns(col =>
{
col.Bound(p => p.ID).Hidden();
col.Bound(p => p.Year);
col.Bound(p => p.State);
col.Bound(p => p.DueDate).Format("{0:MM/dd/yyyy}");
col.Bound(p => p.DownloadDate).Format("{0:MM/dd/yyyy}");
})
.AutoBind(false)
.Pageable(x => x.PageSizes(UISettings.PageSizes))
.Sortable(x => x.AllowUnsort(false))
.Resizable(resizing => resizing.Columns(true))
.Scrollable(s => s.Height("auto"))
.DataSource(dataSource => dataSource
.Ajax()
.Sort(x => x.Add(y=>y.DownloadDate).Descending()).Sort(x=>x.Add(y=>y.DueDate).Descending())
.Read(read => read
.Action("GetData", "Tracking"))
.ServerOperation(false))
)
Run Code Online (Sandbox Code Playgroud) 有谁知道要设置什么属性来制作剑道MVC文本框多线?
@(Html.Kendo().TextBox()
.Name("txtComments")
.Value(@Model.Comments)
.HtmlAttributes(new { style = "width:100%" })
)
Run Code Online (Sandbox Code Playgroud)
谢谢.
我正在使用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>
Run Code Online (Sandbox Code Playgroud)
编辑cshtml文件后,我按下Control + K + D自动格式化.Visual Studio正确格式化html和一行中配置的任何内容.但是,在多行上配置的任何窗口小部件都会被一个选项卡缩进.因此,在上述情况下,一切从.Name("SearchGrid")到).Deferred()))被一个标签缩进.
问题是,每一次我编辑CSHTML我按时间Control + K …
我是kendo.Ui的首发,我为创建网格编写了这段代码
@(Html.Kendo().Grid<BrandViewModel>(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.BrandName);
columns.Bound(p => p.BrandAbbr);
columns.Bound(p => p.SrcImage);
columns.Command(command => command.Custom("Edit").Click("editItem"));
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("CustomCommand_Read", "Brand"))
.Model(model => model.Id(p => p.Id))
)
)
Run Code Online (Sandbox Code Playgroud)
我想当用户点击在kendo窗口中Edit打开的按钮时Edit view我写这段代码
@(Html.Kendo().Window().Name("Details")
.Title("Customer Details")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(300)
)
<script type="text/x-kendo-template" id="template">
<div id="details-container"> <!-- this will be the content of the popup -->
BrandName: <input type='text' value='#= BrandName #' />
</div>
</script>
Run Code Online (Sandbox Code Playgroud)
和java脚本代码:
<script type="text/javascript">
var detailsTemplate = kendo.template($("#template").html());
function …Run Code Online (Sandbox Code Playgroud) 我已经创建了asp.net MVC 4应用程序,其中我使用的是实体框架,类"Data"就是模型.
AdventureWorksTrainingEntities _dbContext = new AdventureWorksTrainingEntities();
Data _data = new Data(); //Model
Run Code Online (Sandbox Code Playgroud)
现在我想将表的数据显示到kendo网格.在控制器中,我使用以下代码:
public ActionResult Index()
{
List<Movie> dataForGrid= _dbContext.Movies.ToList();
return View(dataForGrid);
}
Run Code Online (Sandbox Code Playgroud)
现在我不知道在Kendo Grid中显示数据(我是kendo和MVC的新手).我也试过以下但没有工作:
@model IEnumerable<MvcApp.Models.Data>
@using Kendo.Mvc.UI
@{
ViewBag.Title = "Index";
}
<h2>Grid For Data</h2>
Html.Kendo().Grid<Order>()
.Name("Grid")
.DataSource(dataSource => dataSource // Not implemented
)
Run Code Online (Sandbox Code Playgroud) asp.net-mvc asp.net-mvc-4 kendo-ui kendo-grid kendo-asp.net-mvc
我需要在特定列上默认对网格进行分组,并且不允许用户删除该列上的分组.这可能吗?
我在Kendo Window里面有一个Kendo Grid.如何使用包装器启用其水平滚动?
我尝试过任何东西,但都没有奏效.我尝试的最后一件事是围绕Grid,宽度有限div.
@(Html.Kendo().DropDownListFor(model => model.ServiceID)
.OptionLabelTemplate("#=optionLabel#")
.ValueTemplate("#=Code#(#=Rate#) - #=Description#")
.Template("#=Code#(#=Rate#) - #=Description#")
.DataTextField("Code")
.DataValueField("ServiceID")
.DataSource(d =>
{
d.Read(read =>
{
read.Action("GetServiceRepository", "Service").Data("...")
.Type(HttpVerbs.Post);
});
})
.OptionLabel(new { optionLabel = Resources.Wording.SelectOne, ServiceID = 0, Rate = 0, Code = "" })
)Run Code Online (Sandbox Code Playgroud)
我有一个Kendo Dropdownlist,它使用HTML帮助方式而不是JQuery方式初始化.
无论如何使用JSONcontentType而不是默认值来发布/ Service/GetServiceRepository的发布请求application/x-www-form-urlencoded?
kendo-grid ×7
kendo-ui ×6
asp.net-mvc ×4
javascript ×2
jquery ×2
razor ×2
json ×1
kendo-ui-mvc ×1
multiline ×1
telerik-mvc ×1
textbox ×1