Hi Telerik,
I'm usingASP.NET MVC Grid and I want using Column Template in server side but it's not working with my code:
<div id="clientsDb"> @(Html.Kendo().Grid<vw_Products>() .Name("grid") .Columns(columns => { columns.Template(item => "<img class='product-photo' src='" + ImageModel.GetThumbnail(item.Images) + "' alt='" + item.Title + "' /></td>") .Width(140).Title("Picture"); columns.Bound(c => c.Title).Title("Product Name").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))); columns.Bound(c => c.Price).Title("Price").Width(300).Filterable(ftb => ftb.Cell(cell => cell.Operator("gte"))); }) .HtmlAttributes(new { style = "height: 700px;" }) .Scrollable() .Groupable() .Sortable() .Filterable(ftb => ftb.Mode(GridFilterMode.Row)) .Pageable(pageable => pageable .Refresh(true) .PageSizes(pageSizes) .ButtonCount(5)) .DataSource(dataSource => dataSource .Ajax() .PageSize(30) .Read(read => read.Action("Products_Read", "Home")) ) )</div>I think my set up is ok but it's not working, the column Template is Empty plz help me. Thanks
columns.Template(item => "<img class='product-photo' src='" + ImageModel.GetThumbnail(item.Images) + "' alt='" + item.Title + "' /></td>")

Hi,
I'm trying to use the grid component in a huge legacy ASP.NET MVC 5 project. For some reason the ​Html.Kendo().Grid() helper does not serialize my grid's data if I am using it in this project, but it does serialize the data if I use it in a brandnew ASP.NET MVC project.
I used the same source code in the view for both projects:
@{ var dummy = new List<DummyModel> { new DummyModel { Col1 = "Foo1", Col2 = "Bar1" }, new DummyModel { Col1 = "Foo2", Col2 = "Bar2" } };}@(Html.Kendo().Grid(dummy).Name("MyGrid") .Columns(col => { col.Bound(c => c.Col1); col.Bound(c => c.Col2); }))
In a brand new MVC5 project, this renders the following html / js code blocks:
<div class="k-widget k-grid" id="MyGrid"> <table> <colgroup> <col/><col/> </colgroup><thead class="k-grid-header"> <tr> <th class="k-header" data-field="Col1" data-index="0" data-title="Col1" scope="col"> <span class="k-link">Col1</span></th><th class="k-header" data-field="Col2" data-index="1" data-title="Col2" scope="col"> <span class="k-link">Col2</span></th> </tr> </thead><tbody> <tr> <td>Foo1</td><td>Bar1</td> </tr><tr class="k-alt"> <td>Foo2</td><td>Bar2</td> </tr> </tbody> </table></div><script> jQuery(function() { jQuery("#MyGrid").kendoGrid({ "columns": [{ "title": "Col1", "headerAttributes": { "data-field": "Col1", "data-title": "Col1" }, "field": "Col1", "encoded": true }, { "title": "Col2", "headerAttributes": { "data-field": "Col2", "data-title": "Col2" }, "field": "Col2", "encoded": true }], "scrollable": false, "messages": { "noRecords": "No records available." }, "autoBind": false, "dataSource": { "type": (function() { if (kendo.data.transports['aspnetmvc-server']) { return 'aspnetmvc-server'; } else { throw new Error('The kendo.aspnetmvc.min.js script is not included.'); } })(), "transport": { "read": { "url": "" }, "prefix": "MyGrid-" }, "serverPaging": true, "serverSorting": true, "serverFiltering": true, "serverGrouping": true, "serverAggregates": true, "filter": [], "schema": { "data": "Data", "total": "Total", "errors": "Errors", "model": { "fields": { "Col1": { "type": "string" }, "Col2": { "type": "string" } } } } } }); });</script>​
This works fine and the table is displayed correctly.
​However, in my legacy project this renders the following html / js code blocks:
<div class="k-widget k-grid" id="MyGrid"> <table> <colgroup></colgroup><thead class="k-grid-header"></thead><tbody> <tr></tr><tr class="k-alt"></tr> </tbody> </table></div><script> jQuery(function() { jQuery("#MyGrid").kendoGrid({ "scrollable": false, "messages": { "noRecords": "Keine Aufzeichnungen zur Verfügung." }, "autoBind": false, "dataSource": { "type": (function() { if (kendo.data.transports['aspnetmvc-server']) { return 'aspnetmvc-server'; } else { throw new Error('The kendo.aspnetmvc.min.js script is not included.'); } })(), "transport": { "read": { "url": "" }, "prefix": "MyGrid-" }, "serverPaging": true, "serverSorting": true, "serverFiltering": true, "serverGrouping": true, "serverAggregates": true, "filter": [], "schema": { "data": "Data", "total": "Total", "errors": "Errors", "model": { "fields": { "Col1": { "type": "string" }, "Col2": { "type": "string" } } } } } }); });</script>
The js code is identical to the brand new MVC 5 project, but the html code is missing the serialized data, which results in the table not being displayed correctly. You can easily see this by the fact that the strings "foo" or "bar" are nowhere in the source code.
I have double-checked that both projects are using the same Kendo.Mvc.dll reference, so that can't be the problem. I've also read the manual twice on how to set up Kendo UI twice and that did not help, so now I am stuck.
Thanks in advance for your help,
Adrian
Hi,
We encountered "internet explorer has stopped working" issue when adding rows to grid. The IE version is 11.
Based on our investigation, the issue seems is due to we are calling the following javascript function after we adding new row to the grid.
Could you provide some pinions on this issue or suggest how to investigate the Internet explorer stop working issue?
​
function Reset(id) { //reset inputs var inputs = $("#" + id + " input"); for (var m = 0; m < inputs.length; m++) { if (inputs[m].id != "") { $("#" + inputs[m].id).val(''); } } //reset kendoNumericTextBox var currency = $("#" + id + " [data-role=numerictextbox]"); for (var m = 0; m < currency.length; m++) { if (currency[m].id != "") { $("#" + currency[m].id).data("kendoNumericTextBox").value(''); } } //reset kendoDateTimePicker var picker = $("#" + id + " [data-role=datetimepicker]"); for (var m = 0; m < picker.length; m++) { if (picker[m].id != "") { $("#" + picker[m].id).value(''); $("#" + picker[m].id).blur(); } } //reset kendoDropDownList var dropDown = $("#" + id + " [data-role=dropdownlist]"); for (var m = 0; m < dropDown.length; m++) { if (dropDown[m].id != "") { $("#" + dropDown[m].id).data("kendoDropDownList").value(''); } } //hidden error message var spans = $("#" + id + " [class='k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error']"); if (spans.length > 0) { spans.addClass("hidden"); }}
Controllercode:
01.namespace vEF_AspApplication.Controllers02.{03. public class AddressesController : Controller04. {05. private MyDataModelContext db = new MyDataModelContext();06. 07. // GET: Addresses08. public async Task<ActionResult> Index()09. {10. var addresses = db.Addresses.Include(a => a.FormOfAddress).Include(a => a.Title);11. return View(await addresses.ToListAsync());12. }13. }14.}Viewcode:
01.@(Html.Kendo().MobileView()02. .Title("EntityFramework DataAccess")03. .Name("Index")04. .Content(@<text>05. <div id="AddressList">06. @(Html.Kendo().Grid<vEF_Library.Address>()07. .Name("AddressGrid")08. .Columns(columns =>09. {10. columns.Bound(c => c.LastName);11. columns.Bound(c => c.FirstName);12. columns.Bound(c => c.Phone);13. })14. .HtmlAttributes(new { style = "height: 100%;" })15. .HtmlAttributes(new { style = "width: 100%;" })16. .Scrollable()17. //.Groupable()18. .Sortable()19. .Pageable(pageable => pageable20. .Refresh(true)21. .PageSizes(true)22. .ButtonCount(10))23. .DataSource(dataSource => dataSource24. .Ajax()25. .Read(read => read.Action("Index", "Addresses"))26. )27. )28. </div>29. </text>)30.)What is wrong?
With the release of ASP.NET 5 beta 8 ...when we upgraded our MVC web application from 7 to 8 we ran into the following error.
Microsoft.AspNet.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
This was being caused by the Kendo.Mvc of reference of which we were using the 2015.3.930 release. We are wondering when will there be a release made that will be compatible with the latest beta release since the RC1 is supposed to be released in only a few short weeks from now and we are trying to keep our upgrade project rolling along with these releases.
We are hoping to not have to remove the reference and then switch our control usage from the wrappers back to coding everything in typescript. As this would cause us to have to refactor our controllers to remove the DataSourceRequest usages.
Thanks for any information you can provide.
AJ
Hi,
I have a Grid with batch editing. When I start to edit cell I have to capture the value of it (with changes made while editing) to send it to the controller.
How can I get this value? I have managed to get the cell itself with following javascript but it does not hold the value:
function cellData() { var grid = $("#CustomerOrderPosition").data('kendoGrid'); var cellId = grid._cellId; var cell = document.getElementById(cellId); }
Greetings! I have a set of grids to export to Excel. I completed the first, with the help of your fine demo apps.
I have quite a bit of code for the OnExcelExport(e) event to set Excel column widths, cell colors, etc. For example:
//Set column width and wrap textif (colIndex == 0) { row.cells[colIndex].wrap = true; sheet.columns[colIndex].autoWidth = false; sheet.columns[colIndex].width = 63;}if (colIndex == 5 || colIndex == 6 || colIndex == 7) { row.cells[colIndex].wrap = true; sheet.columns[colIndex].autoWidth = false; sheet.columns[colIndex].width = 72;}My question is :Is there a way to store metadata in the column definition of the grid that I can read in OnExcelExport(e) so that I can create shared, generic functions to set the Excel attributes or must I code each grid like this (referencing column order, etc.)? I tried stuffing attributes in the clientTemplate but this always seemed to affect my HTML grid...
Best,
Scott
If I have a treelist or grid with "popup" editing and an autosync datasource, how can I have the popup editor appear immediately for the new record?
It seems that with autosync, the create action is called immediately and no popup editor appears.
Ideally I would like the popup before going to the create action (same as without autosync).
It would be acceptable for the popup to appear after calling the create action on the server, so that it is editing a record filled with defaults.
Hi,
I have a chart which shows 3 lines. My client asks whether it is possible to have a background color between the lowest and highest line inside the area.
See the attachment for my example. The red lines mark the area which should be a light, gray color.
Any ideas?
Best,
Daniel