DropDownList The binding indicates that the data is delayed
The first step shows the value
Second step display text
How can I add the sum of a column to the pageing footer like in this example:
https://s3.amazonaws.com/telerik-media/telerik-videos/controls/grid-bootstrap-fallback.jpg
I would like to replace the text in the picture "56 cars matching your criteria" with "Total Price: $x.xx"
Im using 3 tier.
1 presenter
2 service (webapi & service business logic layer)
3 data access
this is my presenter code
@(Html.Kendo().Grid<
ParkingRevenueViewModel
>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.ParkDate).Width(20).Title("Date").Format("{0:dd/MM/yyyy}").Filterable(true);
columns.Bound(p => p.VehRegNbr).Width(100).Title("Vehicle No");
columns.Bound(p => p.RoadName).Width(150).Title("Road").Filterable(false);
columns.Bound(p => p.LotNo).Width(50).Title("Lot No");
columns.Bound(p => p.StartTime).Width(100).Title("Parking Time").Format("{0:dd/MM/yyyy h:mm:ss tt}").Filterable(false);
columns.Bound(p => p.Value).Width(50).Title("Value").Filterable(false);
})
.Filterable()
.Pageable()
.DataSource(dataSource =>
dataSource
.WebApi()
.Aggregates(aggregates =>
{
aggregates.Add(p => p.Value).Sum();
})
.Events(events => events.Error("error_handler"))
.Read(read => read.Url("http://novawebapi.azurewebsites.net/api/reports/ParkingRevenueByMonth"))
).Deferred()
)
this is my webapi code
[HttpGet("ParkingRevenueByMonth")]
public DataSourceResult ParkingRevenueByMonth([DataSourceRequest]DataSourceRequest request, int? Month = 0)
{
var model = reportsService.GetParkingRevenueByMonth(request, Month);
return model;
}
service layer
public DataSourceResult GetParkingRevenueByMonth(DataSourceRequest request, int? Month=0)
{
var now = DateTime.Now.ConvertToMalaysiaTime();
if (Month == null || Month == 0)
{
Month = now.Month;
}
var firstOfMonth = new DateTime(now.Year, (int)Month, 1);
var endOfMonth = firstOfMonth.AddMonths(1).AddMilliseconds(-1);
var list = unitOfWork.GetRepository<
ParkTable
>().GetAll().Where(w=> firstOfMonth.Date <= w.TimeStart.Date && w.TimeStart.Date <= endOfMonth.Date);
var returnModel = list.Select(s => new ParkingRevenueViewModel
{
ParkDate = s.TimeStart.Date,
VehRegNbr = s.VehRegNbr,
LotNo = s.GeoRoadParkLot.GeoParkLot.LotNo,
RoadName = s.GeoRoadParkLot.GeoRoad.Description,
StartTime = s.TimeStart,
Value = s.Amount
});
return returnModel.ToDataSourceResult(request);
}
the error thrown
at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionNewExpression(IEnumerable`1 propertyValuesExpressions)
at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionInitExpression()
at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateAggregateFunctionsProjectionMemberBinding()
at Kendo.Mvc.Infrastructure.Implementation.Expressions.QueryableAggregatesExpressionBuilder.<
CreateMemberBindings
>d__3.MoveNext()
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at System.Dynamic.Utils.CollectionExtensions.ToReadOnly[T](IEnumerable`1 enumerable)
at System.Linq.Expressions.Expression.MemberInit(NewExpression newExpression, IEnumerable`1 bindings)
at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateSelectExpression()
at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
at Kendo.Mvc.Extensions.QueryableExtensions.Aggregate(IQueryable source, IEnumerable`1 aggregateFunctions)
at Kendo.Mvc.Extensions.QueryableExtensions.CreateDataSourceResult[TModel,TResult](IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState, Func`2 selector)
at Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(IEnumerable enumerable, DataSourceRequest request)
at NI.Service.ReportsServices.GetParkingRevenueByMonth(DataSourceRequest request, Nullable`1 Month) in d:\documents\visual studio 2017\Projects\Nova\NI.Service\ReportsServices.cs:line 53
at NI.WebApi.Controllers.ReportsController.ParkingRevenueByMonth(DataSourceRequest request, Nullable`1 Month) in d:\documents\visual studio 2017\Projects\Nova\TestApi2\Controllers\ReportsController.cs:line 32
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<
InvokeActionMethodAsync
>d__27.MoveNext()
Hi referring to the attached, What should I write to capture the old record &latest record ?
1. On Button clicked on "Saved Changes" [Show in [1]]
2. On Clicked on "Button" [Shown in [2]]
I have tried but i am still getting the old records but no avail .... perhaps some enlightenment will be great..
When I try to add event to a multiselect I get this error
cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
I have tried these to method to add event
@(Html.Kendo().MultiSelectFor(m => m.OmviserNavne)
.Placeholder("Vælg omviser...")
.BindTo(ViewBag.Omviser)
.Events(e =>
{
e.Change("onOmviserChange")
})
.Deferred())
@(Html.Kendo().MultiSelectFor(m => m.OmviserNavne)
.Placeholder("Vælg omviser...")
.BindTo(ViewBag.Omviser)
.Events(events => events.Change("onOmviserChange"))
.Deferred())
Hello,
I'm trying to get a grid with a select option just like this example http://demos.telerik.com/aspnet-core/grid/checkbox-selection
My grid loads with all the proper data however the columns.Select().Width(50); does not load any check boxes like the example does.
Here is the code that I am using. I will also attach a screen shot of what this produces.
@(
Html.Kendo()
.Grid<PlanReviewItemViewModel>()
.Name("linkFolderAttachmentPlanReviewItems")
.Columns(col =>
{
col.Select().Width(50);
col.Bound(p => p.MunicipalNumber);
})
.Sortable()
.DataSource(ds =>
{
ds.Ajax()
.Read(read =>
{
read.Action("GetPlanReviewItems", "PlanReviewItemsApi", new { caid = "PLDG5" });
});
})
)
I have a grid with an editor template like so:
@model decimal?
@(Html.Kendo().DropDownList()
.Name("VatRate")
.DataValueField("DecimalValue")
.DataTextField("Name")
.BindTo((System.Collections.IEnumerable)ViewData["VatRates"])
)
In my grid I have the column defined like so:
columns.Bound(p => p.VatRate).EditorTemplateName("DropDownListVatRates");
The VatRate property is defined like so:
public
decimal
VatRate {
get
;
set
; }
What I would like is for select the appropriate VAT rate and for the DDL to pass the decimal value back to the cell (something like this http://www.screencast.com/t/V41xQlYWq )
But I can't figure out how to do it, any help would be appreciated?