Telerik Forums
UI for ASP.NET Core Forum
1 answer
281 views

Hi Telerik Team

I’m using ASP.NET CORE (.NET7) with
Telerik.UI.for.AspNet.Core Version="2023.1.425"

I'm trying to use TreeView and it always displays text:   No records to display

My Code:

I configured json options

--- Program.cs --------------------------------------------------------------------------------------------
builder.Services.AddControllersWithViews()
    .AddJsonOptions(options => {
        options.JsonSerializerOptions.PropertyNamingPolicy = null;
                });

----- Controller -------------------------------------------------------------------------------------------

public JsonResult GetTestTreeViewData([DataSourceRequest] DataSourceRequest request)
    {
        var result = GetDirectory().ToTreeDataSourceResult(request,
            e => e.ObjectId,
            e => e.ParentId,
            e => e
        );
        return Json(result);
    }


    private IEnumerable<TreeViewTest> GetDirectory()
    {
        return Enumerable.Range(start: 1, count: 10).Select(i => new TreeViewTest
        {
            ObjectId = i,
            ObjectName = "Object Name " + i,
            ParentId = i - 1,
            ParentName = "Parent Name " + (i - 1)
        });
    }

--- View -------------------------------------------------------------------------------------------

@using Kendo.Mvc.UI
@using MwTech.Domain.Entities;


@(Html.Kendo().TreeList<TreeViewTest>()
        .Name("treelist")
        .Columns(columns =>
        {
            columns.Add().Field(e => e.ObjectName).Width(200);
            columns.Add().Field(e => e.ObjectId).Width(100);
            columns.Add().Field(e => e.ParentName).Width(200);
            columns.Add().Field(e => e.ParentId).Width(100);
        })
        .Filterable()
        .Sortable()
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("GetTestTreeViewData", "Bom"))
            .ServerOperation(false)
            .Model(m =>
            {
                m.Id(f => f.ObjectId);
                m.ParentId(f => f.ParentId);
                m.Expanded(true);
                m.Field(f => f.ObjectName);
                m.Field(f => f.ParentName);

            })
        )
        .Height(540)
)

In DevTools I can see json object:

  1. {Data: [{ObjectId: 1, ObjectName: "Object Name 1", ParentId: 0, ParentName: "Parent Name 0"},…],…}
    1. AggregateResults: {}
    2. Data: [{ObjectId: 1, ObjectName: "Object Name 1", ParentId: 0, ParentName: "Parent Name 0"},…]
      1. 0: {ObjectId: 1, ObjectName: "Object Name 1", ParentId: 0, ParentName: "Parent Name 0"}
      2. 1: {ObjectId: 2, ObjectName: "Object Name 2", ParentId: 1, ParentName: "Parent Name 1"}
      3. 2: {ObjectId: 3, ObjectName: "Object Name 3", ParentId: 2, ParentName: "Parent Name 2"}
      4. 3: {ObjectId: 4, ObjectName: "Object Name 4", ParentId: 3, ParentName: "Parent Name 3"}
      5. 4: {ObjectId: 5, ObjectName: "Object Name 5", ParentId: 4, ParentName: "Parent Name 4"}
      6. 5: {ObjectId: 6, ObjectName: "Object Name 6", ParentId: 5, ParentName: "Parent Name 5"}
      7. 6: {ObjectId: 7, ObjectName: "Object Name 7", ParentId: 6, ParentName: "Parent Name 6"}
      8. 7: {ObjectId: 8, ObjectName: "Object Name 8", ParentId: 7, ParentName: "Parent Name 7"}
      9. 8: {ObjectId: 9, ObjectName: "Object Name 9", ParentId: 8, ParentName: "Parent Name 8"}
      10. 9: {ObjectId: 10, ObjectName: "Object Name 10", ParentId: 9, ParentName: "Parent Name 9"}
    3. Errors: null
    4. Total: 10

 

but TreeView displays no data.

I ran a similar application in asp.net mvc
(
the same view and the same controller)and it worked fine

Whatam I doing wrong ?

 

 

Mihaela
Telerik team
 answered on 12 May 2023
1 answer
417 views

Hi Telerik,

I have a Grid with persistence implemented exactly like described here => https://demos.telerik.com/aspnet-core/grid/persist-state

Sequence of actions:

1) Start application
2) Reorder columns
3) Save state
4) Reorder columns again for testing purpose => another reorder, not reordering back to the original order
5) Load state

=> everything is working fine, order is back to saved state

But:
1) Start application
2) Reorder columns
3) Save state
4) Close app/browser
5) Run app again => original order is back
6) Load state

=> The order of the columns is changing to the saved state, but the Grid hangs in an infinite loop loading the data

 

Grid:


Html.Kendo().Grid<OalViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderNumber).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Width(100).Title("Auftrag").HtmlAttributes(new { style = "text-align: center" }).Locked(true);
                    columns.Command(command => { command.Edit(); }).Width(150).HtmlAttributes(new { style = "text-align: center" }).Locked(true);
                    columns.Bound(p => p.Split).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Width(80).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OrderType).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Width(80).Title("Art").HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OutletIndicator).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Width(80).Title("FIL").HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.AcceptanceDate).Format("{0: dd.MM.yyyy}").Filterable(ftb => ftb.Cell(y => y.Template("datePicker"))).Title("Angenommen am").Width(150).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.AcceptedBy).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Title("Angenommen von").Width(150).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.CreatedBy).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Title("Erstellt von").Width(125).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.Make).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Title("Marke").Width(80).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.Status).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Width(80).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.InvoiceDate).Format("{0: dd.MM.yyyy}").Filterable(ftb => ftb.Cell(y => y.Template("datePicker"))).Title("RG-Dat.").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.InvoicePrintedOk).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Title("RG-Druck").Width(80).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.LicenseNumber).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Title("Kennz.").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.CustomerNumber).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Title("KD-Nr").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.Customer).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Title("KD").Width(100);
                    columns.Group(x => x
                        .Title("Integration").HeaderHtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F;" })
                        .Columns(info =>
                        {
                            info.Bound(p => p.ExactDescription).Width(250).HtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F; text-align: left" }).HeaderHtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F" }).Title("Genaue Beschreibung");
                            info.Bound(p => p.PlannedCompletionDate).Format("{0: dd.MM.yyyy}").Filterable(ftb => ftb.Cell(y => y.Template("datePicker"))).HtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F; text-align: center" }).HeaderHtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F" }).Title("Fertigstellung").Width(100);
                            info.Bound(p => p.PlannedSettlementDate).Format("{0: dd.MM.yyyy}").Filterable(ftb => ftb.Cell(y => y.Template("datePicker"))).HtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F; text-align: center" }).HeaderHtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F" }).Title("RG-Stellung").Width(100);
                            info.Bound(p => p.OrderAvailable).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).HtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F; text-align: center" }).HeaderHtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F" }).Title("Auftrag vorhanden?").Width(100);
                            info.Bound(p => p.OrderBillable).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).HtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F; text-align: center" }).HeaderHtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F" }).Title("Auftrag abrechenbar?").Width(100);
                            //info.Bound(p => p.OrderStatus).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).HtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F" }).HeaderHtmlAttributes(new { style = "border-color:#642A3F; border: 1pt solid #642A3F" }).Title("Auftrags-Status?").Width(100);

                        }));
                    columns.Bound(p => p.OrderValueTotal).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Auftragswert").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.Tax).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Steuer").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OrderValueTotalNoTax).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Auftragswert o. MwSt.").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OrderValueVehicle).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Auftragswert Fzg").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OrderValueEquipment).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Auftragswert Zubehör").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OrderValueFlatRateUnits).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Auftragswert AW").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OrderValueParts).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Auftragswert Teile").Width(100).HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.OrderValueSublets).Format("{0:C}").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").Title("Auftragswert Sonstiges").Width(100).HtmlAttributes(new { style = "text-align: center" });
                })
                .ColumnResizeHandleWidth(20)
                .ColumnMenu()
                .Sortable()
                .Scrollable(s => s.Height("auto"))
                .Filterable()
                .Reorderable(reorder => reorder.Columns(true))
                .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("CustomPopupOAL"))
                .ToolBar(toolbar =>
                {
                     toolbar.Custom().Text("Import DMS").IconClass("k-icon k-i-file-excel").HtmlAttributes(new { id = "customCommand" });
                     toolbar.Excel();
                     toolbar.Pdf();
                     toolbar.Custom().Text("Ansicht speichern").IconClass("k-icon k-i-export").HtmlAttributes(new { id = "save" });
                     toolbar.Custom().Text("Ansicht laden").IconClass("k-icon k-i-import").HtmlAttributes(new { id = "load" });
                     toolbar.Search();
                })
                .Pdf(pdf => pdf.AllPages(true))
                .Excel(excel => excel.AllPages(true))
                .Pageable(p => p
                     .ButtonCount(5)
                     .PageSizes(new[] { 10, 25, 50 })
                     .Refresh(true)
                     .Input(true)
                )
                .HtmlAttributes(new { style = "height:600px;" })
                .DataSource(dataSource => dataSource
                    .SignalR()
                    .AutoSync(false)
                    .PageSize(10)
                    .Aggregates(aggregates =>
                    {
                        aggregates.Add(p => p.OrderValueTotal).Sum();
                        aggregates.Add(p => p.Tax).Sum();
                        aggregates.Add(p => p.OrderValueTotalNoTax).Sum();
                        aggregates.Add(p => p.OrderValueVehicle).Sum();
                        aggregates.Add(p => p.OrderValueEquipment).Sum();
                        aggregates.Add(p => p.OrderValueFlatRateUnits).Sum();
                        aggregates.Add(p => p.OrderValueParts).Sum();
                        aggregates.Add(p => p.OrderValueSublets).Sum();
                    }                    )
                    .Transport(tr => tr
                        .Promise("hubStart")
                        .Hub("hub")
                        .Client(c => c
                            .Read("read")
                            .Create("create")
                            .Update("update")
                            .Destroy("destroy"))
                        .Server(s => s
                            .Read("read")
                            .Create("create")
                            .Update("update")
                            .Destroy("destroy")))
                    .Schema(schema => schema
                        .Model(model =>
                        {
                            model.Id(order => order.OrderNumber);
                            model.Field(p => p.OrderNumber).Editable(false);
                            model.Field(p => p.Split).Editable(false);
                            model.Field(p => p.OrderType).Editable(false);
                            model.Field(p => p.OutletIndicator).Editable(false);
                            model.Field(p => p.AcceptanceDate).Editable(false);
                            model.Field(p => p.AcceptedBy).Editable(false);
                            model.Field(p => p.CreatedBy).Editable(false);
                            model.Field(p => p.Make).Editable(false);
                            model.Field(p => p.Status).Editable(false);
                            model.Field(p => p.InvoiceDate).Editable(false);
                            model.Field(p => p.InvoicePrintedOk).Editable(false);
                            model.Field(p => p.LicenseNumber).Editable(false);
                            model.Field(p => p.CustomerNumber).Editable(false);
                            model.Field(p => p.Customer).Editable(false);
                        }
                 )
              )
            )

Javascript:


<script>
    $(document).ready(function () {
        var grid = $("#grid").data("kendoGrid");

        $("#save").click(function (e) {
            e.preventDefault();
            localStorage.kendogridoptions = kendo.stringify(grid.getOptions());

        });

        $("#load").click(function (e) {
            e.preventDefault();
            var options = localStorage.kendogridoptions;
            if (options) {
                grid.setOptions(JSON.parse(options));
            }
        });

    });
</script>

Note: In the javascript code above you will see a difference to the demo code. I Changed 


localStorage["kendo-grid-options"] = kendo.stringify(grid.getOptions());

to


localStorage.kendogridoptions = kendo.stringify(grid.getOptions());

Because I researched the problem and found a lot of sources telling that the proper/better way of accessing the localstorage would be by using "localStorage.<VALUE-NAME>".

But first I tried with the exaxt demo code, also running into the same problem.

What am I doing wrong? After restarting the app and loading the state, the order of the colums is changed, but the grid is unable to load the data.

Is it because I use SignalR binding? I need realtime updates as many users are working in the same grid at the same time, and this is only working with SignalR, correct?

Appreciate any tips!

Thanks

Thomas

Mihaela
Telerik team
 answered on 10 May 2023
1 answer
168 views

Everything else within the control works, however the list view and icon view switching buttons do not. Upon clicking the list or icon view buttons as below, the error message at the bottom appears, and I have located no reason why this is the case.

 

kendo.all.js:313050  Uncaught Error: There is no  ViewComponent registered!
    at init.view (kendo.all.js:313050:21)
    at init.exec (kendo.all.js:313050:21)
    at init.executeCommand (kendo.all.js:313050:21)
    at init._toolbarClick (kendo.all.js:313050:21)
    at init.trigger (kendo.all.js:313050:21)
    at init._onSelect (kendo.all.js:313050:21)
    at init.trigger (kendo.all.js:313050:21)
    at init._select (kendo.all.js:313050:21)
    at init.trigger (kendo.all.js:313050:21)
    at init._click (kendo.all.js:313050:21)

Stoyan
Telerik team
 answered on 10 May 2023
1 answer
125 views

Hey, On my schedule editor pop up I'd like to enforce the server side model validation, however currently, if ModelState.IsValid == false, rather than keeping the editor open and showing an error it closes.

Is there a way for the editor to stay open if the model validation returns false?

 

        public async Task<JsonResult> SchedulerCreate([DataSourceRequest] DataSourceRequest request, TaskViewModel task)
        {

            if (ModelState.IsValid)
            {
                await Persist(task);

            }
            return Json(new[] { task }.ToDataSourceResult(request, ModelState));
        }
           
Alexander
Telerik team
 answered on 08 May 2023
2 answers
802 views

Hi there,

I have a hard time getting my grid displaying the data I want to see.

 

Main Object

public class CustomerViewModel
{
    [Key]
    public string Vin { get; set; }
    public List<Campaign> TechnicalCampaigns { get; set; } = new();
    public string? CustomerNumber { get; set; }
    public string? CustomerName { get; set; }
}


Campaign Model


public class Campaign
{
    public string Vin { get; set; }
    public string CampaignId { get; set; }
}


Grid


Html.Kendo().Grid<CustomerViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.Vin).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Width(100).Title("Vin").HtmlAttributes(new { style = "text-align: center" }).Locked(true);
                    columns.Command(command => { command.Edit(); }).Width(150).HtmlAttributes(new { style = "text-align: center" }).Locked(true);
                    columns.Bound(p => p.CustomerNumber).Filterable(ftb => ftb.Cell(y => y.Template("datePicker"))).Width(100).Title("Kundennummer").HtmlAttributes(new { style = "text-align: center" });
                    columns.Bound(p => p.CustomerName).Filterable(ftb => ftb.Multi(true).Search(true).CheckAll(true)).Width(100).Title("Kunde").HtmlAttributes(new { style = "text-align: center" });

                    columns.Bound(p => p.TechnicalCampaigns).Width(200).Title("Offene TA's").HtmlAttributes(new { style = "text-align: center" }).ClientTemplate("#=generateTemplate(TechnicalCampaigns)#");

                .ColumnResizeHandleWidth(20)
                .ColumnMenu()
                .Sortable()
                .Scrollable(s => s.Height("auto"))
                .Filterable()
                .Reorderable(reorder => reorder.Columns(true))
                .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("CustomPopupTA"))                
                .DataSource(dataSource => dataSource
                    .SignalR()
                    .AutoSync(false)
                    .PageSize(10)
                    .Sort(sort => sort.Add("Vin").Descending())
                    .Transport(tr => tr
                        .Promise("hubStart")
                        .Hub("hub")
                        .Client(c => c
                            .Read("read")
                            .Create("create")
                            .Update("update")
                            .Destroy("destroy"))
                        .Server(s => s
                            .Read("read")
                            .Create("create")
                            .Update("update")
                            .Destroy("destroy")))
                    .Schema(schema => schema
                        .Model(model =>
                        {
                            model.Id(p => p.Vin);
                            model.Field(p => p.Vin).Editable(false);
                        }
                 )
              )
            )

I want to show the TechnicalCampaigns in a column. To be more specific: For each Campaign in List TechnicalCampaigns I want to display the string Campaign.CampaignId.

I have read every single thread in this forum regarding custom columns, customtemplates, using cshtml files as template, or forwarding the list in a customtemplate to a js function, iterating and returning values. 

Absolutely nothing is working. It can't be that hard to display a simple string, or a list of strings, in a column.

 

Any hint would be greatly appreciated!

 

Cheers

Tom

Thomas
Top achievements
Rank 2
Iron
 answered on 07 May 2023
0 answers
162 views

We often have hacking attempts like https://our_ip/Telerik.Web.UI.WebResource.axd?....

Can I change the name of WebResource.axd to something like xyz.axd?

Alfeu
Top achievements
Rank 1
 asked on 05 May 2023
2 answers
472 views

I have a drop down list suppling a parameter to my grid to load data specifically based on the selected drop down list item.  It is working on filtering data and sorting, and when the drop down list change event.  Some reason the Excel Export is not working.  Any information would be appreciated.

<select asp-page-handler="LoadGrid" asp-items="Model.Months" asp-for="@Model.mySetDate" value="@Model.mySetDate" onselect="this.EditLog.submit();" onchange="DoPostBack();" class="form-control" ></select>
        <br />

 

<kendo-grid name="gvRequests" navigatable="true" auto-bind="true" on-excel-export="excelExport">
            <pageable enabled="true" page-size="100"></pageable>
            <sortable enabled="true" />
            <filterable enabled="true" />
            <columns>
                <column field="LogID" width="100" hidden="true" />
                <column field="SetDate" title="Set Date" width="100" template="#= kendo.toString(kendo.parseDate(SetDate, 'yyyy-MM-dd'), 'MM/dd/yyyy') #"  />
                <column field="Project" title="Project" width="200" />
                <column field="Task" title="Task" width="200" />
                <column field="Action" title="Action" width="200" />
                <column field="LogHours" title="Hours" width="200" />
                <column template="<input name='Edit' type='submit' value='Edit LogID:#=LogID#' />"></column>
            </columns>
            <datasource type="DataSourceTagHelperType.Ajax" server-operation="true">
                <transport >
                    <read  url="@Url.Content("~/ManageLog?handler=Read")" datatype="json" type="POST" data="forgeryToken"  />
                    
                </transport>
            </datasource>
            <toolbar>
                <toolbar-button name="excel" action=""></toolbar-button>
            </toolbar>
            <excel all-pages="true" file-name="EntryLog.xlsx" proxy-url="@Url.Content("~/ManageLog?handler=Read")" data="kendo.antiForgeryTokens()"  />
            
        </kendo-grid>
        


        <script>
            function forgeryToken() {
                var select = document.getElementById("mySetDate");
                var option = select.options[select.selectedIndex];
                const requestVerificationToken = '@Xsrf.GetAndStoreTokens(HttpContext).RequestToken';
                const beforeSend = req => req.setRequestHeader('RequestVerificationToken', requestVerificationToken);
                const grid = $("#gvRequests").getKendoGrid();
                grid.dataSource.transport.options.read.beforeSend = beforeSend;

                //return kendo.antiForgeryTokens();
                var values = {};
                
                values["mydate"] = option.value;
                return values;

                //return {
                //    antiForgeryTokens: kendo.antiForgeryTokens(),
                //    mydate: option.value//$("#ServiceCompany").val()
                //};

            }
        </script>
        <script type="text/javascript">


    function DoPostBack() {
        var select = document.getElementById("mySetDate");
        var option = select.options[select.selectedIndex];
        if (option.value != "Please select") {
            
            //$("#gvRequests").data("kendoGrid").setDataSource(dataSource);
            $('#gvRequests').data('kendoGrid').dataSource.read({ mydate: option.value })
            
        }
    }
        </script>
Mitchell
Top achievements
Rank 1
Iron
 answered on 03 May 2023
1 answer
304 views

This is how my grid is defined - and was working before upgrading to 2023.1.425 (this is a Razor page):

@(Html.Kendo().Grid(Model.InvoiceList)
	.Name("ResultGrid")
	.Groupable(ga => ga.ShowFooter(false))
	.DataSource(ds => ds
		.Ajax()
		.ServerOperation(false)
		.Group(gr => gr.Add(gp => gp.CompanyName))
		.Aggregates(aggregates =>
		{
			aggregates.Add(field => field.CheckTotal).Sum();
			aggregates.Add(field => field.CheckTotal).Count();
		})
	)
	.Mobile(MobileMode.Phone)
	.Sortable(s => s
		.AllowUnsort(true)
		.SortMode(GridSortMode.Mixed)
		.ShowIndexes(true)
	)
	.Scrollable(s => s.Enabled(true).Height("auto"))
	.Columns(c =>
	{
		c.Bound(res => res.InvoiceID).Title("ID").ClientTemplate("<a href='/invoicesummary/#= InvoiceID #' target='_blank'>#= InvoiceID #</a>");
		c.Bound(res => res.CheckDate).Title("Check Date").Format("{0:MM/dd/yyyy}");
		c.Bound(res => res.CheckNo).Title("Check No");
		c.Bound(res => res.CheckTotal).Title("Check Amount").Format("{0:C2}");
		c.Bound(res => res.PayTo).Title("Payee");
		c.Bound(res => res.CompanyName).Title("Company Name")
			.ClientGroupHeaderTemplate("#= data.value # - Total: #= kendo.format('{0:C2}', data.aggregates.CheckTotal.sum) # in #= data.aggregates,CheckTotal.count # invoice(s)").Hidden(true);
	})
	.ColumnMenu(m => m
		.ComponentType("modern")
	)
	.Reorderable(r => r.Columns(true))
	.Resizable(rs => rs.Columns(true))
)

Here is the error I am getting:

An unhandled exception occurred while processing the request.
MissingMethodException: Method not found: 'System.Exception Roslyn.Utilities.ExceptionUtilities.get_Unreachable()'.
Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseQualifiedNameRight(NameOptions options, NameSyntax left, SyntaxToken separator)

Stack Query Cookies Headers Routing
MissingMethodException: Method not found: 'System.Exception Roslyn.Utilities.ExceptionUtilities.get_Unreachable()'.
Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseQualifiedNameRight(NameOptions options, NameSyntax left, SyntaxToken separator)
Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseQualifiedName(NameOptions options)
Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseUnderlyingType(ParseTypeMode mode, NameOptions options)
Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseTypeCore(ParseTypeMode mode)
Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseType(ParseTypeMode mode)
Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseTypeName()
Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParseTypeName(string text, int offset, ParseOptions options, bool consumeFullText)
Kendo.Mvc.Infrastructure.Implementation.ClassFactory.DeclareDynamicProperty(DynamicProperty property)
System.Linq.Enumerable+SelectEnumerableIterator<TSource, TResult>.ToArray()
Kendo.Mvc.Infrastructure.Implementation.ClassFactory.GetDynamicClass(IEnumerable<DynamicProperty> properties)
Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionNewExpression(IEnumerable<Expression> propertyValuesExpressions)
Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionInitExpression()
Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateAggregateFunctionsProjectionMemberBinding()
Kendo.Mvc.Infrastructure.Implementation.Expressions.QueryableAggregatesExpressionBuilder.CreateMemberBindings()+MoveNext()
System.Collections.Generic.LargeArrayBuilder<T>.AddRange(IEnumerable<T> items)
System.Collections.Generic.EnumerableHelpers.ToArray<T>(IEnumerable<T> source)
System.Dynamic.Utils.CollectionExtensions.ToReadOnly<T>(IEnumerable<T> enumerable)
System.Linq.Expressions.Expression.MemberInit(NewExpression newExpression, IEnumerable<MemberBinding> bindings)
Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateSelectBodyExpression()
Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateSelectExpression()
Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
Kendo.Mvc.Extensions.QueryableExtensions.Aggregate(IQueryable source, IEnumerable<AggregateFunction> aggregateFunctions)
Kendo.Mvc.Extensions.QueryableExtensions.CreateDataSourceResult<TModel, TResult>(IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState, Func<TModel, TResult> selector)
Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState)
Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable queryable, DataSourceRequest request)
Kendo.Mvc.UI.DataSource.Process(DataSourceRequest request, bool processData)
Kendo.Mvc.UI.Grid<T>.ProcessDataSource()
Kendo.Mvc.UI.Grid<T>.ProcessSettings()
Kendo.Mvc.UI.WidgetBase.RenderHtml(TextWriter writer)
Kendo.Mvc.UI.WidgetBase.ToHtmlString()
Kendo.Mvc.UI.Fluent.WidgetBuilderBase<TViewComponent, TBuilder>.ToHtmlString()
Kendo.Mvc.UI.Fluent.WidgetBuilderBase<TViewComponent, TBuilder>.WriteTo(TextWriter writer, HtmlEncoder encoder)
Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers.ViewBuffer.WriteToAsync(TextWriter writer, HtmlEncoder encoder)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0<TFilter, TFilterAsync>(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultFilters>g__Awaited|28_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Show raw exception details
System.MissingMethodException: Method not found: 'System.Exception Roslyn.Utilities.ExceptionUtilities.get_Unreachable()'.
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseQualifiedNameRight(NameOptions options, NameSyntax left, SyntaxToken separator)
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseQualifiedName(NameOptions options)
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseUnderlyingType(ParseTypeMode mode, NameOptions options)
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseTypeCore(ParseTypeMode mode)
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseType(ParseTypeMode mode)
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseTypeName()
   at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParseTypeName(String text, Int32 offset, ParseOptions options, Boolean consumeFullText)
   at Kendo.Mvc.Infrastructure.Implementation.ClassFactory.DeclareDynamicProperty(DynamicProperty property)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()
   at Kendo.Mvc.Infrastructure.Implementation.ClassFactory.GetDynamicClass(IEnumerable`1 properties)
   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()+MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   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.CreateSelectBodyExpression()
   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(IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState)
   at Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable queryable, DataSourceRequest request)
   at Kendo.Mvc.UI.DataSource.Process(DataSourceRequest request, Boolean processData)
   at Kendo.Mvc.UI.Grid`1.ProcessDataSource()
   at Kendo.Mvc.UI.Grid`1.ProcessSettings()
   at Kendo.Mvc.UI.WidgetBase.RenderHtml(TextWriter writer)
   at Kendo.Mvc.UI.WidgetBase.ToHtmlString()
   at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString()
   at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.WriteTo(TextWriter writer, HtmlEncoder encoder)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers.ViewBuffer.WriteToAsync(TextWriter writer, HtmlEncoder encoder)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultFilters>g__Awaited|28_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

If I comment out the Aggregates key, everything works fine except I don't have my summarization I need to display.  Like I said, this worked right up until I upgraded the library to the new version.  I also made sure that all of the scripts and CSS are compatible versions.  I have no idea what this message is telling me.  I read something on StackOverflow that suggested adding a parameter-less constructor to the model, but that did not work.

Anything anyone can point would be much appreciated.

Dave
Top achievements
Rank 2
Iron
Iron
 answered on 02 May 2023
1 answer
99 views

Hi,

When I try to use the adaptive mode in your scheduler adaptive demo https://docs.telerik.com/aspnet-mvc/html-helpers/scheduling/scheduler/adaptive-rendering I can't figure out how to save a new appointment.

I am seeing the same behaviour in my application on mobile devices.

The form for a new appointment opens up but there doesn't seem to be any way to save it.

What am I missing?

Thanks,

Charlotte

Aleksandar
Telerik team
 answered on 02 May 2023
1 answer
124 views

Hi,

I am successfully able to display a nested grid. However there is a new requirement and I need some help.

For simplicity, please consider the following.

Outer grid displays grade information with columns like Grade, Instructor, Room

Inner grid display student information with columns like Name, Race.

So far so good.

Now based a condition in outer grid i.e. if Grade is 12, I would like to add a column to the inner grid called SATAppeared. That is,  I would like a grid like the following

Grade   Instructor   Room

    3          Kelly            20

    Name   Race

      Bo         W

      Li           A

Grade   Instructor   Room

    12          Mac            34

    Name   Race   SATAppeared

      Sue        W            Yes

      Ken        W             No

 

To achieve this, in the template of inner grid, I have put a condition on SATAppeared column. Something like the following but it doesnt seem to work. SATAppeared column doesnt display for any of the grades.

.Columns(columns =>
 {

   columns.Bound(o => o.Name);

   columns.Bound(o => o.Race);

if (Model.Grade == "12")
{
      columns.Bound(o => o.SATAppeared);
}

}

Can you please help. Thank you!

Aleksandar
Telerik team
 answered on 02 May 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?