kendo-asp.net-mvc

How Can I Have Row Number In Kendo UI Grid

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 05:57:12
问题 I have kendo grid in asp.net mvc and i use server wrapper.I want Additional column named "Row Number" that is simple counter (1,2,3,...). I want this counter never change by client sorting. Always first row be 1 second row be 2 ,... in column "RowNumber" how can I do this in kendo grid ? 回答1: You can use the dataBound event: $("#grid").kendoGrid({ sortable: true, dataSource: [{ name: "Jane Doe", age: 30 }, { name: "John Doe", age: 33 }], columns: [{ field: "name" }, { field: "age" }, { field:

Kendo : ComboBox in a grid - Sending additional data of selected combobox to combobox Read()

对着背影说爱祢 提交于 2019-11-29 16:44:38
ASP.NET MVC5 I have a combobox in a grid (InLine Edit): columns.Bound(x=>x.AccountID).EditorTemplateName("MyTemplate") Where MyTemplate is in /Shared There are millions of Accounts. When I try to edit the combo box in a grid and choose a new value, the ID of the Account, not the name, appears. This is because of course the name of the account is not immediately present so in the Read().Data() of the ComboBox.Datasource I need to send additional data ; the AccountID. My ComboBox Template looks like this: .DataSource(source=> source.Read(read => read.Action("ReadAccounts".....) .Data("HERE IS

How to handle a Kendo UI Grid row double-click event

怎甘沉沦 提交于 2019-11-29 13:24:17
问题 I have a selectable KendoUI grid in my MVC app. I want to do something when the user double-clicks on the grid. I don't see a double-click event for the grid. How may I handle the double-click event when there is none exposed? 回答1: Use the standard double click event. The first click will select the grid row, adding a .k-state-selected class to it, and the second click will trigger the double click event. $("#yourgridname").on("dblclick", "tr.k-state-selected", function () { // insert code

Javascript runtime error: “object doesn't support property or method” in Internet Explorer

岁酱吖の 提交于 2019-11-29 12:59:42
I'm using kendo grids and they work fine for the CRUD operations. Now, I wanted to add filtering by adding the .Filterable() option to the grid's specification. Here's some code: <div id="datagrid"> @(Html.Kendo().Grid<SustIMS.Models.ConcessionModel>() .Name("datagrid_Concessions") .Columns(columns => { columns.Bound(c => c.Code).Title("Code"); columns.Bound(c => c.Description).Title("Description"); columns.Bound(c => c.TrafficOpeningDate).Title("Traffic Opening Date"); columns.Bound(c => c.CreationDate).Title("Creation Date"); }) .HtmlAttributes(new { style = "height: 534px;" }) .Filterable()

Get a reference to Kendo Grid from inside the error handler

ⅰ亾dé卋堺 提交于 2019-11-29 12:29:00
问题 There already are questions how to get custom error handling, with answers, but all those answers use 'external' reference/selector to the grid to make it work, for example: function onError(e) { if (e.errors) { var message = "Error:\n"; var grid = $('#gridID').data('kendoGrid'); // <<- here (...) } Is it possible to get the reference to the grid from inside the error handling function without providing the selector by hand or 'externally' (because global variables are meh )? That way the

Kendo grid image column

寵の児 提交于 2019-11-29 10:22:31
working on a MVC4 project, I'm trying to add a column to my kendo grid that displays an image. <div id="datagrid"> @(Html.Kendo().Grid<SustIMS.Models.ConcessionModel>() .Name("datagrid_Concessions") .Columns(columns => { columns.Bound(c => c.Code).Title(ViewBag.lblCode); columns.Bound(c => c.Description).Title(ViewBag.lblDescription); columns.Template(@<text> <img src='@item.Image' /> </text> ).Title("Image"); }) I've tried that but no luck. Also tried: columns.Template(@<text> <img src='../../Images/pic.png' /> </text> ).Title("Image"); The images aren't shown, whether I define the image src

Binding a DropDownList in Kendo Scheduler Custom Template (ASP.NET MVC Wrapper version)

非 Y 不嫁゛ 提交于 2019-11-28 23:56:18
I'm using the ASP.NET MVC wrapper for Kendo UI and I'm trying to bind several dropdownlists within a custom template (x-kendo-template). I can't figure out how to do this using the ASP.NET MVC Wrapper (this is similar to this question: How do I bind a DropDownList to a DataSource within an editor template using the scheduler? ). There are some examples on using the Kendo Web version, but no complete examples out there that show using a custom pop-up editor with the scheduler that contains a dropdownlist pulling data from a URL (json data). Is there an end-to-end example? I can load the

How to add row number to kendo ui grid?

天涯浪子 提交于 2019-11-28 23:37:19
I have a kendo ui grid in my page that has some columns. Now I want to add a column to it that shows me row number. How to I do this? Thanks. Initialize a variable and show it in column as template: "#= ++record #" Working Demo Here is code: var record = 0; $("#grid").kendoGrid({ dataSource: { data: [{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo"

Cannot display enum values on Kendo grid

本秂侑毒 提交于 2019-11-28 11:50:19
In my MVC5 application I have an enum class as shown below and with this approach I can pass the enum values i.e. US, UK instead of United States" from Controller to View. How can I pass and display enum description with the following approach? I tried many different solution method as C# String enums , etc. but none of them solved my problem. On the other hand, I do not want to use sealed class and it would be better for me a solution with enum class as shown below: Enum: public enum Country { [Description("United States")] US = 1, [Description("United Kingdom")] UK = 2, [Description("New

How Can I Have Row Number In Kendo UI Grid

为君一笑 提交于 2019-11-28 11:29:46
I have kendo grid in asp.net mvc and i use server wrapper.I want Additional column named "Row Number" that is simple counter (1,2,3,...). I want this counter never change by client sorting. Always first row be 1 second row be 2 ,... in column "RowNumber" how can I do this in kendo grid ? You can use the dataBound event: $("#grid").kendoGrid({ sortable: true, dataSource: [{ name: "Jane Doe", age: 30 }, { name: "John Doe", age: 33 }], columns: [{ field: "name" }, { field: "age" }, { field: "rowNumber", title: "Row number", template: "<span class='row-number'></span>" }], dataBound: function () {