Hi,
Am using Javascript for rendering a Kendo Grid. In Grid Edit pop up i have a script Template which is an MVC Kendo Template below,
<script id="popup-editor" type="text/x-kendo-template">
<div>
@(Html.Kendo().DatePickerFor(m => m.USReleaseDate).HtmlAttributes(new { @class = "form-control", placeholder = "US Release Date" }).Deferred()) </div>
</script>
Following is my Kendo Editor pop up template code in javascript
template: kendo.template($("#popup-editor").html())
which is perfectly rendering values as expected.
However the problem is, the controls inside the pop up is a plain Html control (<input>) instead of kendo date picker. As i read in the forum, i tried to initialize it below the template like this
<script>
$(function () {
var usReleaseDate = $("#USReleaseDate");
if (usReleaseDate) {
$("#USReleaseDate").kendoDatePicker( {
"format": "MM/dd/yyyy",
"min": new Date(1900, 0, 1, 0, 0, 0, 0),
"max": new Date(2099, 11, 31, 0, 0, 0, 0) });
}
});
but of no use. How can i render kendo controls within a popup editor?
I just installed the trial version and I can't seem to get the DatePicker to function as it does in the example.
I added the scripts and styles to the directories as instructed.
We are MVC3 so my _Layout file looks like:
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="../../Content/kendo/kendo.common.min.css"></script>
<script src="../../Content/kendo/kendo.default.min.css"></script>
<script src="@Url.Content("~/Scripts/kendo/jquery.min.js")"></script>
@*<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>*@
<script src="../../Scripts/kendo/kendo.all.min.js"></script>
<script src="../../Scripts/kendo/kendo.aspnetmvc.min.js"></script>
</head>
Everything seems to function correctly but the display doesn't match and I'm seeing Unexpected Token errors in the kendo.common.min.css and kendo.default.min.css files.
below is the code on the documentation page for server filtering a dropdownlist
http://demos.telerik.com/aspnet-mvc/dropdownlist/serverfiltering
Does this actually do anything ?
namespace Kendo.Mvc.Examples.Controllers
{
using System.Web.Mvc;
public partial class DropDownListController : Controller
{
public ActionResult ServerFiltering()
{
return View();
}
}
}
Hi
I would like ask how to improve example below to display text from drop down list after save item?
https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/grid-editing-cascading-dropdownlist
Drop down lists work as I need but after save I see id. How to change it to display text for example category name.
Hi There,
I am trying to Get 'Copy To Excel' to work in Batch Edit Mode. (GridEditMode.InCell)
I used the Telerik example below (razor/grid/editing) and added the two following lines to be able to copy to Excel:
.Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple).Type(GridSelectionType.Cell))
.AllowCopy(true)
(Telerik\UI for ASP.NET MVC Q2 2015\wrappers\aspnetmvc\Examples\VS2013)
However, I am not able to copy to Excel.
Here is the code with the added lines in bold:
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
.Name("Grid")
.Columns(columns => {
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice).Width(140);
columns.Bound(p => p.UnitsInStock).Width(140);
columns.Bound(p => p.Discontinued).Width(100);
columns.Command(command => command.Destroy()).Width(110);
})
.ToolBar(toolbar => {
toolbar.Create();
toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple).Type(GridSelectionType.Cell))
.AllowCopy(true)
.Pageable()
.Navigatable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(20)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.ProductID))
.Create("Editing_Create", "Grid")
.Read("Editing_Read", "Grid")
.Update("Editing_Update", "Grid")
.Destroy("Editing_Destroy", "Grid")
)
)
Cheers,
Greg
Hi,
I am working on Kendo Grid with MVC.Net. I am using CRUD operations with editor template. I am unable to get the model id value in editor template to figure out if it is a new record or existing record.
Here is my grid configuration which in cshtml file
@(Html.Kendo()
.Grid<TestRecord>()
.Name("Test")
.Columns(columns =>
{
columns.Bound(col => col.Id);
columns.Bound(col => col.Name);
columns.Command(command => { command.Edit(); command.Destroy(); });
})
.ToolBar(toolbar => toolbar.Create().Text("Add New Record"))
.Editable(editable => editable
.Mode(GridEditMode.PopUp)
.TemplateName("TestEditor"))
.Sortable()
.DataSource(dataSource =>
{
dataSource
.Ajax()
.ServerOperation(false)
.Model(m =>
{
m.Id(a => a.Id);
m.Field(a => a.Name)
})
.Read(read => read.Action("TestRead", "TestControl", new { id = this.Model.Id }))
.Create(create => create.Action("TestRead", "TestControl"))
;
})
)
My Editor is in separate file names TestEditor.cshtml. I am able to add/edit records without any issues. I need to update only one column if it is existing record. Hence I am hiding the remaining fields (other than the one I am updating) in the editor window. So I was wondering if I can use the model's Id column to figure out if it is a new record or not.
Here is my editor template : TestEditor.cshtml
@model TestRecord
// Render all the columns
@if (this.Model.Id > 0)
{
// only updated related column
}
Regards,
Chen
I have a chart, which allows the user to click on a column, to refresh the chart with data from the next level in the hierarchy.
It works well, apart from the rightmost columns, on narrower displays. In these cases, the tooltip completely obscures the column, making clicking on them difficult.
I've attached an example image.
The chart definition is:-
@(Html.Kendo().Chart<
Dashboard.Models.BarChartDataItem
>(Model)
.Name((string)ViewBag.ChartName)
.Title((string)ViewBag.ChartTitle)
.Theme("bootstrap")
.Legend(legend => legend
.Position(ChartLegendPosition.Top)
.Visible(false)
)
.Series(series =>
{
series.Column(model => model.BarValue).Name("Actual").Tooltip(t=>t.Visible(true).Template("<
div
>Category:#=dataItem.AxisDescription#</
br
>Contribution: £#=dataItem.DisplayBarValue#</
div
>"));
})
.ChartArea(area => area
.Height(350)
.Background("transparent")
)
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels.Format("{0:N0}"))
.Title((string)ViewBag.Yaxis)
.AxisCrossingValue(0, int.MinValue)
.Line(line => line.Visible(false))
)
.CategoryAxis(axis => axis
.Labels(false))
.CategoryAxis(axis => axis
.Categories(model => model.AxisValue)
.Labels(labels => labels.Rotation(-45).Padding(5))
.MajorGridLines(lines => lines.Visible(false))
.Title((string)ViewBag.Xaxis)
)
.Events(e=>e.SeriesClick("seriesClick"))
.Tooltip(tooltip => tooltip
.Visible(true)
.Format("{0:N2}")
)
)
Is it possible to change the tooltip position? There don't seem to be any position options available.
In this case, displaying at the top of the column would be best, ensuring nothing is obscured.
Thanks
Good afternoon.
Are there any example projects where the following is happening:
1. Initial Spreadsheet control is blank.
2. Upon selection of a an excel file .. loading it into the spreadsheet.
3. Spreadsheet is in read only format.
I have looked at the following demo...
http://demos.telerik.com/aspnet-mvc/spreadsheet/server-side-import-export
but it is preloading something that 1. I do not want, 2. i cannot even find the json file it is uploading.
I have tried to use the export function (to JSON) to export the initially loaded products json file and then reimport it using the code in the controller.... but it gives me serialization errors.
Thanks,
Corey
Hi Guys,
I have a grid that uses batch editing (GridEditMode.InCell).
This grid also uses a few Foreign Key columns.
If I use the .Navigatable() option, I can tab through the cells, but the foreign key columns don't show up as pick list anymore but as integer.
I believe the following example would have the same issue if it had a foreign key column.
http://demos.telerik.com/aspnet-mvc/grid/editing
is this a bug with MVC Grid or am I missing an option ?
Cheers,
Greg