Note: It seems your forum no longer has formatting options for pasting code.
I have an odd behavior where I can't pass a String value from my model to the JavaScript behind the Grid. I pass int? values without issue but Strings do not pass.
This works fine:
var customerId = Number(@Model.CustomerId);
This does not work:
var uniqueId = @Model.CustomerUniqueId;
var uniqueId = String(@Model.CustomerUniqueId);
My full grid and scripts:
@(Html.Kendo().Grid<Person>()
.Name("grid")
.Columns(columns =>
{
columns.Command(command => command
.Custom("Detail")
.Click("goDetail"))
.Width(Glossary.Portal.ButtonWidth);
columns.Bound(p => p.FirstName)
.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
.ShowOperators(false)
.SuggestionOperator(FilterType.Contains)));
columns.Bound(p => p.LastName)
.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
.ShowOperators(false)
.SuggestionOperator(FilterType.Contains)));
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("IndexJson", "Persons")
.Data("getData"))
))
<script type="text/javascript">
var customerId = Number(@Model.CustomerId);
var customerInfoId = Number(@Model.CustomerInfoId);
var groupId = Number(@Model.GroupId);
var sessionId = Number(@Model.SessionId);
function getData() {
return {
customerId: customerId,
customerInfoId: customerInfoId,
groupId: groupId,
sessionId: sessionId
};
}
function goDetail(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
window.location.href = '@Url.Action("Details", "Persons")?id=' + dataItem.Id + '&customerId=' + customerId + '&customerInfoId=' + customerInfoId + '&groupId=' + groupId + '&sessionId=' + sessionId;
}
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors,
function(key, value) {
if ('errors' in value) {
$.each(value.errors,
function() {
message += this + "\n";
});
}
});
alert(message);
}
}
</script>
Hi, I am having an odd problem.
I am using a DateTimePicker in a popup template for a grid.
When I go to edit a record, for the very first time, and the popup comes up, the DateTimePicker does not display the time right and neither of the 2 buttons on the right appear. There is a box displayed, but that's it. No calendar or time dropdown available.
However, if I close the template popup and reopen it for the current or any other record it works as advertised.
Any ideas?
Thanks … Ed
I'm very interested in this new FileManager to potentially navigate through thousands of photographs stored on Azure Blobs.
1) Will the Preview Pane display thumbnails of images? Or just glyphs of the file types?
2) Anyone tried it with Azure Blobs yet? There is a rudimentary folder structure possible, but I've not tried it yet. Wondering if anyone else has.


I am not sure why, but when I use DataUrlField, the subMenu refuses to close and stays open.
I even tried forcing the issue by using CloseOnClick(true). If I comment out the DataUrlField, then the menu works as I would expect, closing on click, or if I set it to CloseOnClick(false) it stays open as expected. As soon as I add the DataUrlField it seems to force the CloseOnClick to false.
Any ideas what I might be doing wrong, or a workaround?
Here is the snippet:
@(Html.Kendo().Menu() .Name("absMenu") .DataTextField("Label") .DataSource(ds => ds.Read("GetNavMenus", "NavMenus") .Model(model => model.Children("hasChildren"))) .Orientation(MenuOrientation.Vertical) .CloseOnClick(true) .HighlightPath(false) .Animation(a => a.Open(o => o.SlideIn(SlideDirection.Right).Duration(100))) //.DataUrlField("Action") )In my current grid definition (below) below the <script type="text/javascript"> line, I go through and define some variables in the JavaScript that are populated from Properties in my Model. This works for me but I would like to refactor the code to be more simple.
Refactor 1:
I would like to pull the values directly from my model so it is just a single call. What kind of object do I return from my @Model.GetDataValues() method that would satisfy the Grid.DataSource.Data call?
function getData() {
return @Model.GetDataValues();
}
Refactor 2:
What would even be cleaner is to not call the JavaScript function at all. What kind of object do I return from my @Model.GetDataValues() method that would satisfy the Grid.DataSource.Data parameter directly?
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("IndexJson", "Users")
.Data(@Model.GetDataValues()))
My Grid Definition:
@(Html.Kendo().Grid<Person>()
.Name("grid")
.Columns(columns =>
{
columns.Command(command => command
.Custom("Detail")
.Click("goDetail"))
.Width(Glossary.Portal.ButtonWidth);
columns.Bound(p => p.FirstName)
.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
.ShowOperators(false)
.SuggestionOperator(FilterType.Contains)));
columns.Bound(p => p.LastName)
.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
.ShowOperators(false)
.SuggestionOperator(FilterType.Contains)));
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("IndexJson", "Users")
.Data("getData"))
))
<script type="text/javascript">
var customerId = Number(@Model.GetValue(Glossary.Models.Customer.Keys.Id));
var customerUniqueId = '@Model.CustomerUniqueId';
var groupId = Number(@Model.GetValue(Glossary.Models.Group.Keys.Id));
var sessionId = Number(@Model.GetValue(Glossary.Models.Session.Keys.Id));
var personId = Number(@Model.GetValue(Glossary.Models.Person.Keys.Id));
function getData() {
return {
customerId: customerId,
customerUniqueId: customerUniqueId,
groupId: groupId,
sessionId: sessionId,
personId: personId
};
}
...
Hi,
we have an issue with KendoMultiSelect get unusable after an modal KendoWindow was opened on top of the page that contains multi select control. All the data are there, values are still selected, but control is unusable - you cannot open the dropdown to select new values.
We are using 2017.3.913 version.
Kind regards
Paul
Hi I have the following problem I have a keno grid bringing up a popup but its not firing my update command for some reason. The main difference to my site and the demos is that I am using language as part of my url.
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{culture=en-gb}/{controller=Home}/{action=Index}/{id?}");
endpoints.MapRazorPages();
});
@(Html.Kendo().Grid<Stock>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ID);
columns.Bound(p => p.Description).Width(180);
columns.Bound(p => p.Name).Width(180);
columns.Command(command => command.Edit()).Width(160);
columns.Command(command => command.Destroy()).Width(160);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Pageable()
.Navigatable()
.Sortable()
.Groupable()
.Filterable()
.Scrollable()
.HtmlAttributes(new { style = "height: 500px" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => events.Error("error"))
.Model(model =>
{
model.Field(p => p.ID).Editable(true);
model.Field(p => p.Name);
})
.Read("ReadStock", "Stock")
.Update("Stock_Update", "Stock"))
.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("StockEditorTemplate"))
)
)
[AcceptVerbs("Post")]
public async Task<ActionResult> Stock_Update([DataSourceRequest] DataSourceRequest request, Stock stockItem)
{
if (stockItem != null && ModelState.IsValid)
{
int x = await apiClient.PostUpdateStock(stockItem);
}
return Json(new[] {stockItem}.ToDataSourceResult(request, ModelState));
}
Hi All,
How to add an Icon marker on my previously selected item. Let say I have default Settings to show 20 rows per page. When I navigate on the menu, it should have an icon in front of the item. If I select 50, the next time I navigate on the menu, 50 has now the icon.
Please see attached.
Thanks,
Ryan
Hi All,
I want to add a clear filter button on my grid toolbar. How can I achieve this?
Is it possible to get each filter changes in array?
Like for instance my I set my 1st filter to column status to show only Active
My 2nd filter is user type admin on user type column
and my 3rd filter to First Name column is Ryan
So if I click the button Clear filter, it will only clear my 3rd filter for First name
and when I click the 2nd time, it will clear my filter for User type Admin
and when I click again the 3rd status active will be cleared.
Actually my main goal here is to put this array in to bread crumb. although I cant seem to make breadcrumb work in my grid toolbar. so button would suffice for now.
