I'm trying to populate a grid dynamically as I have a number of different report data models that need to be displayed in the grid depending on user selection.
Each data model inherits from a common interface, and I'm passing an `IEnumerable` of that interface through to the view.
Generally this works, and the data is displayed, however, the `DisplayAttribute` of the source model is ignored.
If I supply an `IEnumerable` of the model itself, this works, however, as the view needs to support dynamically specified models, I cannot do this.
I have tried the `LoadSettings` method shown in the grid demo, however, I get an error because the `Member` property specified cannot be found on the interface.
How can I dynamically specify the model to use and have the grid honour the data annotations of the model?

Hi,
I needed to make link click work on my grid that will show my custom modal. Tried code below but I cant seem to make it work. Any ideas on making this work?
Thanks in advance.
columns.Bound(column => column.Email).Filterable(ftb => ftb.Multi(true).Search(true)).ClientTemplate("#= userDetails(data) #")
<script>
function userDetails(user) {
var html = kendo.format("<strong><a href='#' onclick='openModal('" + user + "');'>"+ user.Email +"</a></strong>");
return html;
}
function openModal(user) { <---- Not firing
alert(JSON.stringify(user));
$('#mdlUserInfo').modal('show');
}
</script>
Is there a template for columns.Command(command => command.Custom(template).Click("showDetails")).Width(45);
I want to show button with Icon instead of text.
Thanks
I have separated a timestamp in my model so that I can get a good filtering experience in the grid. However, the filtering mechanism for the Time column remains the calendar. How do I set this to filter using a time picker? Also, as defined I expected there to be no filter for the Time column. But, there is one. How do I turn off the filter of this column if it shows even with no definition?
@(Html.Kendo().Grid<Session>() .Name("grid") .Columns(columns => { columns.Command(command => command .Custom("Detail") .Click("goDetail")) .Width(Glossary.Portal.ButtonWidth); columns.Bound(p => p.Device.Name).Title("Device") .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains") .ShowOperators(false) .SuggestionOperator(FilterType.Contains))); columns.Bound(p => p.Date).Title("Date").Format("{0:MM/dd/yyyy}") .Filterable(ftb => ftb.Cell(cell => cell.Operator("gte") .ShowOperators(false))); columns.Bound(p => p.Time).Title("Time").Format("{0:hh:dd:mm tt}"); }) .Pageable() .Sortable() .Scrollable() .Filterable(ftb => ftb.Mode(GridFilterMode.Row)) .HtmlAttributes(new { style = "height:596px;" }) .Selectable() .Navigatable() .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Read(read => read.Action("IndexJson", "Sessions") .Data("getData"))))<script>function getData() { return @Html.Raw(Model.GetIndexData());}function goDetail(e) { e.preventDefault(); var dataItem = this.dataItem($(e.currentTarget).closest("tr")); var url = '@Url.Action("Details", "Sessions")?id=' + dataItem.Id + '@Model.GetUrlParameters()'; // Replace & with & as the above encoding step changes & to &. window.location.href = url.replace(/&/g, "&");}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>
@(Html.Kendo().Grid(Model) .Name("GridOrders") .Columns(columns => { columns.Bound(p => p.Barcode).ClientTemplate("<a href='https://fisherbioservicesdev.platformforscience.com/sprint2demo/corelims?cmd=get-barcode&headerBarcode=#=Barcode#&headerEntityType=0' target=_blank>#=Barcode#</a>"); ; columns.Bound(p => p.FBS_KITREQUEST_REQUESTEREMAIL); columns.Bound(p => p.FBS_KITASREQ_STATUS); columns.Bound(p => p.SiteName); columns.Bound(p => p.FBS_KITREQUEST_DATEREQUESTED).ClientTemplate("#= FBS_KITREQUEST_DATEREQUESTED? kendo.toString(kendo.parseDate(FBS_KITREQUEST_DATEREQUESTED, 'yyyy-MM-ddTHH:mm:ssZ'), 'MM/dd/yyyy'): '' #"); columns.Command(command => command.Custom("Details").Click("detailsRedirect")).Width(150); }) .ToolBar(t => t.Search()) .Pageable() .Navigatable() .Sortable() .Filterable() .DataSource(dataSource => dataSource .Ajax() .Batch(true) .PageSize(20) .ServerOperation(false) .Events(events => events.Error("error_handler")) ))
This is what my code looks like. Attached is what is displayed.It is not showing a search box. What am I doing wrong?
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.

