For anyone who can help - I'm having an issue with gte and lte on dates in the the grid. It works fine if I put a date before and after one for a start/end date but it does not work if the date happens to be equal. For example I have a date 10/08/2014 I know is in my database for DateEntered but the record will only show if I set start date to 10/07/2014 and enddate to 10/09/2014. Neither of them can be 10/08/2014 - won't work that way even tho those filters imply the "or equal to" part.
Here's my script for the filters:
if ((startDate != "") && (Date.parse(startDate))) {
datesFilter.filters.push({ field: "DateEntered", operator: "gte", value: new Date(startDate) });
}
if ((endDate != "") && (Date.parse(endDate))) {
datesFilter.filters.push({ field: "DateEntered", operator: "lte", value: new Date(endDate) });
}
if (datesFilter.filters.length) {
$filter.push(datesFilter);
}
Any help would be greatly appreciated!
Thanks,
Craig
I am trying to figure out how I can download the files I just uploaded via the file upload control.
I was hoping the code below would give me a link I could then click on to download the file from the list in the control.
After some digging it looked like the recommended approach was to use a template on the upload control, however it looks like you are limited on what you can pass in to the model for the template.
I have the following code:
I have specified this template: I am guessing by the errors that it doesn't like the FileUploadId, ProjectId or AttachmentName fields. Is there away to provide a different model to the template?
<script id="fileUploadTemplate" type="text/x-kendo-template">
<span class='k-progress'></span>
<div class='file-wrapper'>
<a href="/ProductFiles/Upload/DownloadFile?fileUploadId=#= FileUploadId #&Projectd=#= ProjectId #">#= AttachmentName #</a>
<button type='button' class='k-upload-action'></button>
</div>
</script>
@(Html.Kendo().Upload()
.Name("projectFiles")
.Files(
files => {foreach (var f in Model.ProjectUploads)
{
files.Add().Name(f.FileName).Extension(f.UploadType).Size(f.FileSize);
}
})
.Async(a => a
.Save("Save", "Upload", new { area="Products" })
.Remove("Remove", "Upload", new { area = "Products" })
.SaveField("files")
)
.Events(events=>events
.Upload("onProjectFileUpload")
.Remove("onProjectFileUpload")
).TemplateId("fileUploadTemplate")
)
my controller method is:
public FileStreamResult DownloadFile(int fileUploadId, int projectId)
{
var uploads = GetUploadsByProjectId(projectId);
var attachment = uploads.Where(up => up.FileUploadId == fileUploadId).FirstOrDefault();
if (attachment != null)
{
string contentType = "application/octetstream";
var fileStreamResult = new FileStreamResult(new FileStream(attachment.FilePath, FileMode.Open, FileAccess.Read), contentType);
fileStreamResult.FileDownloadName = attachment.FileName;
return fileStreamResult;
}
}
Given the above code, Is this the best way to implement this? Is there another way all together I should be looking at?
Thanks,
Nick
My controller will start several async method, then my cshtml will show a long time white page. I do not want it.
I want to add a a Indeterminate ProgressBar when these async task is running, and when the task is completed, I want to hide this progressbar.
Thanks.
Xavier
I am creating a data-entry page on an ASP.NET MVC Core application using EF Core.
I am using ViewData to populate the ComboBox.
public IActionResult Add()
{
ViewData["CostCenterID"] = _context.CostCenters.ToList();
ViewData["ReasonCodeID"] = _context.ReasonCodes.ToList();
ViewData["ShiftID"] = _context.Shifts.ToList();
return View();
}
The razor view for one of the combo boxes looks like this:
<div class="form-group">
@Html.LabelFor(model => model.Shift, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@(Html.Kendo().ComboBoxFor(model => model.Shift.ShiftID)
.HtmlAttributes(new { @class = "form-control", @style = "width: 35%;" })
.Placeholder("Select a shift...")
.DataValueField("ShiftID")
.DataTextField("Name")
.BindTo((System.Collections.IEnumerable)ViewBag.ShiftID)
)
<span asp-validation-for="Shift" class="text-danger"></span>
</div>
</div>
When I save the form, the Shift property is set and the ShiftID property is still 0. There are a total of 5 combo boxes on this form. One is used just to cascading another combo box. That combo box sets the Entity property as well, and that two needs the ID set. I figure once one gets solved the rest will fall in place. If I use regular select objects with asp-for properties it works, but I want to use the Telerik controls.
The save method looks like this:
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Add(DownTimeEntry downTimeEntry)
{
if (ModelState.IsValid)
{
_context.Add(downTimeEntry);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["CostCenterID"] = _context.CostCenters.ToList();
ViewData["ReasonCodeID"] = _context.ReasonCodes.ToList();
ViewData["ShiftID"] = _context.Shifts.ToList();
return View(downTimeEntry);
}
Any help on this would be appreciated!

Hi,
I have a a grid with inline editing and I am applying templates to each of the controls when editing through uiHints on my viewmodel.
Updating worked fine before implementing virtual scrolling, however after I added the virtual scrolling I am getting null reference errors in the console.
the console error is as follows:
Uncaught TypeError: Cannot read property 'Description' of null at eval (eval at getter (kendo.all.min.js:25), <anonymous>:3:22) at init.set (kendo.all.min.js:28) at init.change (kendo.all.min.js:29) at init.proxy (jquery-2.2.4.js:497) at init.trigger (kendo.all.min.js:25) at init._change (kendo.all.min.js:65) at HTMLInputElement.<anonymous> (kendo.all.min.js:65) at HTMLInputElement.dispatch (jquery-2.2.4.js:4737) at HTMLInputElement.elemData.handle (jquery-2.2.4.js:4549) at Object.trigger (jquery-2.2.4.js:7807)My viewModel with ui hints looks like:
public class FolderRetentionConfigViewModel { public int FolderRetentionConfigId { get; set; } public int SubSubId { get; set; } public int CaLocationId { get; set; } [UIHint("FolderRetentionConfigRetentionCodeTemplate")] public int? RetentionCodeId { get; set; } public string Description { get; set; } [UIHint("FolderRetentionConfigActivePeriodTemplate")] public int? ActivePeriod { get; set; } [UIHint("FolderRetentionConfigInActivePeriodTemplate")] public int? InactivePeriod { get; set; } public string TotalRetention { get; set; } public string Caid { get { return this.SubSub.Title + this.SubSub.Adcode + this.SubSub.Adsubcode; } } public CaLocations CaLocation { get; set; } public RetentionCodes RetentionCode { get; set; } public SubSubCategories SubSub { get; set; } }
and the the template files that the UI Hints are referencing look like this
@model IMSCore.ViewModels.FolderRetentionConfigViewModel@{ EditTemplateHelper etHelper = new EditTemplateHelper(ViewData);}<div> @(Html.Kendo().MaskedTextBox()
.Name("Description")
)
</div>
And my grid looks like this:
@(Html.Kendo().Grid<IMSCore.ViewModels.FolderRetentionConfigViewModel>() .Name("gridFolderRetentionConfig") .HtmlAttributes(new { @class = "container-fluid no-padding" }) .Columns(columns => { columns.Bound(c => c.Caid).Width(110); columns.Bound(c => c.Description); columns.Bound(c => c.RetentionCodeId).ClientTemplate("<div><span> " + "#if(data.RetentionCode != null) { # #:data.RetentionCode.RetentionCode # # } # " + "</span></div>"); columns.Bound(c => c.ActivePeriod); columns.Bound(c => c.InactivePeriod); columns.Command(command => { command.Edit(); }).Width(EditTemplateHelper.COMMAND_WIDTH); }) .Scrollable(scrollable => scrollable.Virtual(true)) .Sortable() .Editable(editable => { editable.Mode(GridEditMode.InLine); }) .Events(e => { //e.Edit("FolderRetentionConfigEditing"); //e.Save("onGridSave"); //e.SaveChanges("onGridSave"); }) .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Model(m => { m.Id(pl => pl.FolderRetentionConfigId); m.Field(p => p.Caid).Editable(false); }) .Read(read => read.Action("GetFolderRetentionDefaults_Post", "FolderRetentionsApi")) .Update(update => update.Action("UpdateFolderRetentionDefaults", "FolderRetentionsApi")) ) )

Hi,
In the absence of a dedicated spot for map questions I'll just post my question here:
If we look at the example code take from here:
@(Html.Kendo().Map().Name("map").Center(30.268107, -97.744821).Zoom(15).Layers(layers =>{ layers.Add().Type(MapLayerType.Tile).UrlTemplate("http://tile2.opencyclemap.org/transport/#= zoom #/#= x #/#= y #.png").Subdomains("a", "b", "c").Attribution("© <a href='http://osm.org/copyright'>OpenStreetMap contributors</a>." +"Tiles courtesy of <a href='http://www.opencyclemap.org/'>Andy Allan</a>"); layers.Add().Type(MapLayerType.Marker).DataSource(dataSource => dataSource .Read(read => read.Action("_StoreLocations", "Map"))).LocationField("LatLng").TitleField("Name");}))
My question is this - in the scenario of using Core Razor Pages we do not have a Controller Action as such.
Could I please if it is possible have a modified sample like the one above except to show using data-source using the new Razor Pages model?
Thanks for your time,
John
Hi,
we have a problem with filtering when grid column is binded to the complex type.
Below you can find the makup for the problematic column and DataSource:
columns.Bound(m => m.PaymentMethod.Name).Title("Payment Method").Width(100)
.Filterable(filterable => filterable.Operators(operators => operators.ForString(str => str.Clear().Contains("contains").IsEqualTo("equals"))));
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(true)
.PageSize(20)
.Model(model =>
{
model.Id(id => id.IdPayment);
model.Field(m => m.PaymentMethod).DefaultValue(new PaymentMethodViewModel());
model.Field(m => m.PaymentStatus).DefaultValue(new PaymentStatusViewModel());
})
.Read(read => read.Action("Read", "Payments"))
.Create(create => create.Action("Create", "Payments"))
.Update(update => update.Action("Update", "Payments"))
.Destroy(destroy => destroy.Action("Delete", "Payments"))
)
When we filter for the first time everything works OK, the correct set of data is returned.
But something breaks the filter button. When we clik the filter button for the second time, filter menu window doesn't show up and there is a JS error in console:
Błąd mapy źródła: TypeError: this.worker is null
URL zasobu: null
URL mapy źródła: null
[Więcej informacji]
Error: Syntax error, unrecognized expression: [data-field=PaymentMethod.Name]
Does Grid for Asp.Net Core supports filtering on complex types?

Hello,
If I change the value of a field which is grouped in the grid (Popup Edit) and save it, the grid does not reflect the changed row in the correct group...
to use grid.refresh() doesn't help - is it necessary to Reload the grid in such a case?
robert

While running the demo at http://demos.telerik.com/aspnet-core/multiselect/serverfiltering I noticed that the MultiSelect is passing filter query string parameters.
For example, searching for chef sends the following parameters:
text: chef
filter[filters][0][value]: chef
filter[filters][0][field]: ProductName
filter[filters][0][operator]: startswith
filter[filters][0][ignoreCase]: true
filter[logic]: and
However the example ignores the filter parameters and implements a contains filter in the controller:
public JsonResult GetProducts(string text) {
products = products.Where(p => p.ProductName.Contains(text)); }

The attached image shows the error for a aspnetcore 2.0 project targeting 461 trying to do server side filtering on a grid, you will get a 500.
public ActionResult CustomerRead([DataSourceRequest] DataSourceRequest request)
{
}
Anyone else running into this issue?