Telerik Forums
UI for ASP.NET Core Forum
6 answers
285 views

Hi,

I have a grid inside a partial view that is bound to a local data (parent viewmodel is passed to the partial view).

The grid displays correctly the datas but when i try to edit a cell, i have this error: 'TypeError: Cannot read property 'Label' of undefined'.
Is there a way to solve this error?

Thanks;

Boyan Dimitrov
Telerik team
 answered on 22 Aug 2018
5 answers
312 views

I am using the 2018.1.221 Kendo UI for .Net Core.  It is a ASP MVC Core app using .net core 2.

This is a grid with Ajax source - the part having issues is here:

            .DataSource(dataSource => dataSource
                .Ajax()
                .Aggregates(a =>
                {
                    a.Add(l => l.Balance).Sum();
                })
                .Read(read => read.Action("Balances_Read", "Balances").Data("getAccountType"))
                .PageSize(250)
            )

This works fine on my development machine (and on a different site hosted on Azure) but on this particular app service I get this exception.  The exception goes away if I remove the aggregates code.  Here is the stack trace upstream from my call:

 

System.Exception: Unable to build typeDynamicClass3
   at Kendo.Mvc.Infrastructure.Implementation.ClassFactory.EmitType(String typeName, CSharpCompilation compilation)
   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>d__3.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 Bryt.Client.Web.Controllers.BalancesController.Balances_Read(DataSourceRequest request, Int32 accountType) in C:\DataDrive\Working\Bryt\Bryt.Client.Web\Controllers\BalancesController.cs:line 65

 

Again, oddly, this is isolated to running on Azure.

Thanks,

Brian

 

 

 

Boyan Dimitrov
Telerik team
 answered on 20 Aug 2018
1 answer
147 views

Hi

We started using Asp.net Core MVC components and have question regarding the tag helpers and wrappers and which to use.

Which one we need to use and when :

      Tag helpers vs Server side wrappers?

Can you please explain when we need to use any one of these and in which we need to use them??  thanks .

 

 

Martin
Telerik team
 answered on 20 Aug 2018
4 answers
294 views

Hi, I was able to embed video using my own template and on change event under image browser.

                            change: function () {
                                var editor = $('#editor').data("kendoEditor");
                                var template = kendo.template($("#video-template").html());
                                var filename = $(".k-imagebrowser").find(".k-state-selected").children("strong").text();
                                var range = editor.getRange();
                                editor.selectRange(range);
                                editor.exec("insertHtml", { value: template({ source: $(".k-imagebrowser").data("kendoImageBrowser").dataSource.data()[0].blob + '/' + filename })});

                            }

 

but after the insert button click, it clears any content inside the editor.

 

Rumen
Telerik team
 answered on 17 Aug 2018
3 answers
926 views

I have already raised an issue on Stack Overflow about this and it is worth extending my enquiries here before my head explodes from the constant banging against my desk...
It's a simple question which will allow me to refactor my code (or not) before I pass an IQueryable to the toDataSource() method.

Does toDataSource() use async methods internally?

I am having problems with second operation on the context with a nested code block called from within my IQueryable.  The Stack Overflow post will explain in more depth.

Thanking anyone who can help in advance!

Stefan
Telerik team
 answered on 17 Aug 2018
2 answers
411 views

I've created a ViewComponent which shows details of a budget.  I pass the budget details model into to the ViewComponent, which works displaying the info, but once I make a change to the cost column (only column you can change). and Click the Save toolbar button... nothing happens.. except the grid is now empty and I see a busy indicator which never stops.  I based my code on the batch example found here: https://docs.telerik.com/aspnet-mvc/helpers/grid/editing/batch-editing   Any help would be appreciated.

 

bud_detailsController:

public ActionResult Editing_Read([DataSourceRequest] DataSourceRequest request)
       {
           IQueryable<bud_details> budgets = _context.Bud_Details;
           DataSourceResult result = budgets.ToDataSourceResult(request);
           return Json(result);
       }
       //[AcceptVerbs("Post")]
       public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<bud_details> budget)
       {
           var entities = new List<bud_details>();
           if (budget != null && ModelState.IsValid)
           {
               foreach (var bud in budget)
               {
                   // _context.Update(budget);
                   var entity = new bud_details
                   {
                       budget_no = bud.budget_no,
                       code = bud.code,
                       cost = bud.cost,
                       description = bud.description,
                       u_key = bud.u_key,
                       project_no = bud.project_no,
                       id = bud.id,
                       section = bud.section
                   };
                   entities.Add(entity);
                   _context.Bud_Details.Attach(entity);
                   _context.Entry(entity).State = EntityState.Modified;
               }
               _context.SaveChanges();
           }
           return Json(entities.ToDataSourceResult(request, ModelState, p => new bud_details
           {
               budget_no = p.budget_no,
               code = p.code,
               cost = p.cost,
               description = p.description,
               u_key = p.u_key,
               project_no = p.project_no,
               id = p.id,
               section = p.section
           }));
       }

 

 

The ViewComponent:

@(Html.Kendo().Grid(@Model.BudgetDetails)
            .Name("BudgetGrid")
            .Columns(columns =>
            {
                columns.Bound(p => p.u_key).Visible(false);
                columns.Bound(p => p.budget_no).Visible(false);
                columns.Bound(p => p.code).Width(100);
                columns.Bound(p => p.description);
                columns.Bound(p => p.cost).Width(200)
                .ClientFooterTemplate("Grand Tot: #= kendo.toString(sum, 'C') #")
                .ClientGroupFooterTemplate("Tot: #= kendo.toString(sum, 'C') #");
            })
            .ToolBar(toolbar =>
            {
                toolbar.Save();
                //toolbar.Pdf();
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            // .Pageable(p => p.Numeric(false).PreviousNext(false))
            //.HtmlAttributes(new { style = "height:550px;" })
            //.Navigatable()
            .Sortable()
            .Scrollable(sc => sc.Endless(true))
            .Filterable()
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                .Aggregates(aggregates =>
                {
                    aggregates.Add(p => p.cost).Sum();
                })
                .Group(groups => groups.Add(p => p.Category))
                .Events(events => events.Error("error_handler"))
                .Model(model => {
                    model.Id(p => p.u_key);
                    model.Field(p => p.code).Editable(false);
                    model.Field(p => p.description).Editable(false);
                })
                .Read(read => read.Action("Editing_Read", "bud_details"))
                .Update(update => update.Action("Editing_Update","bud_details"))
                )
)

 

P.S.  I put breakpoints in "Editing_Read" and "Editing_Update" and they never get hit.  I don't know why they are not being called.

 

Lester

Attila Antal
Telerik team
 answered on 15 Aug 2018
1 answer
233 views

Hi,

I am using TagHelpers to create multiselects in my form. I need to provide custom filtering function to filter my data by two fileds e.g FirstName and LastName (contains FirstName OR contains LastName). How can I do that?

 

Nencho
Telerik team
 answered on 15 Aug 2018
4 answers
1.2K+ views

I have a few groups of columns in my inline grid using columns.Group. I know I can hide these column groups entirely, but I have a dropdown in each row of the grid, and based on what is selected in that dropdown, I am firing a javascript event and examining the selected value. Based on this selected value, I would like to disable or hide these groups of columns in that particular row only! How can I go about doing this?

<p>//this is where I am firing the event:<br>columns.Bound(p => p.sb).Width(200).ClientTemplate("#= sbchange(sb) #");</p><p></p><p>//this is the js function:</p><p>//can i get the row num passed in as a parameter as well?<br>function sbchange(sb) {</p><p>//i would like to disable  columns/fields.of the row where the sb was changed. It's better if i can somehow access the whole column group for that row,</p><p>//so i don't have to go field by field and disable them.</p><p>}</p>
Preslav
Telerik team
 answered on 15 Aug 2018
5 answers
576 views

I cannot figure out how to change the buttons on the grids where "Export to Excel" or "Export PDF" is enabled.  What style can I set (override) that will control the .css for the buttons?

Vessy
Telerik team
 answered on 15 Aug 2018
10 answers
475 views

I see the post below this one with respect to the client group header and it works but must be added to each column.

1) How can I just add text to the grouping header changing it from the default text to "Grouped by Columns : " when the user drags a column there.  And then return it to default text when the user has clicked the icon to remove the grouping on that column?

2) How can I set the minimum width for the column indicator in the grouping header.  Right now it is truncating the text of the column name if it is too wide.

Thanks

Eyup
Telerik team
 answered on 14 Aug 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?