Telerik Forums
UI for ASP.NET Core Forum
2 answers
86 views

I created a custom download with DateRangePicker checked. I have a page with this code:

@(Html.Kendo().DateRangePicker()
    .Name("startEnd")
    .Messages(m => m.StartLabel("Start").EndLabel("End"))
)

When the page loads there is a JavaScript error in the console:

Uncaught TypeError: e._startInput.kendoDateInput is not a function

I created another custom download with DateInput and DateRangePicker checked.

When the page loads there is a different JavaScript error in the console:

Uncaught TypeError: o is not a constructor

I thought the custom download page handled the dependencies. Are there other DateRangePicker dependencies that I need to check?

Thanks

Tim
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 01 Jan 2024
2 answers
546 views

I am in the Process of updating to the latest Kendo version in our Asp core project.
Our previous version was 2023.1.117. I wanted to update to 2023.2.829. 
Previosly all grid Command buttons where just the default grey in the bootstrap 4 theme.
Now the edit buttons have the primary style.
Since our product allows the user to change some colors the blue doesnt fit all the time.
Is there a way to change the primary styling at runtime?`
Maybe globally, because some other smaller compoents have the primary too but those blue accents where not that intrusive.

John
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 29 Dec 2023
0 answers
238 views

Hi,

I fail to figure out a problem

I have a Kendo Grid, that has a ClientDetailTemplate that creates a Tab Strip for each row, in each Tab Strip Item there is a Child Grid
Now I added a new Tab Strip Item with a new Child Grid, but everytime I edit a Row, it sends an Insert Action to the Controller instead of an Edit Action

If I debug the base controller, the model that is send to the Insert Action in the controller is valid

With all other Grids (in the other Tab Strip Items) it seems to work just fine (Edit leads to Update Action)
If I remove the Action for Insert/Create in the Child Grid it does not send any Action to the Controller

Is there a bug in my code? I just can't find out why it behaves like this.
I tried to search for it in the forum, but was not able to find something.

The Code is:
(Most columns removed)
(The grid that calls Insert instead of Update action is the first in the script tag, the second grid in the script component is for reference, where it works as expected)

@(Html.Kendo().Grid<CCPartnerTabDialogDto>()
    .Name("Grid_CCPartnerTabDialog")

    .Columns(columns =>
    {
        columns.Bound(c => c.FILIALID).Title("Fields").Width(200);
    })
    .DataSource(datasource => datasource
        .Ajax()
        .Read(read => read.Action("Read", "CCPartnerTabDialog"))

        .Filter(f => f.Add(val => val.RCDSTS).IsEqualTo(" "))

        .PageSize(30))
    .Filterable(filter => filter.Mode(GridFilterMode.Row))
    .Scrollable()
    .Height("750")
    .Sortable()
    .Reorderable(r => r.Columns(true))
    .Pageable()
    .Resizable(rs => rs.Columns(true))
    .ClientDetailTemplateId("Grid_CCPartnerTabDialog_HierarchyRowTemplate")
    .Events(events =>
    {
        events.DataBound("dataBound");
        events.DetailInit("CCPartnerTabDialogInit");
    }))

<script id="Grid_CCPartnerTabDialog_HierarchyRowTemplate" type="text/kendo-tmpl">

    @(Html.Kendo().TabStrip()
        .Name("TabStrip_CCPartnerTabDialog_Hierarchy_#=PID#")
        .Collapsible(true)
        .Items(tabs =>
        {
            tabs.Add().Text("Partner").Content(@<text>
                @(Html.Kendo().Grid<CCPartnerDto>()
                    .Name("Grid_CCPartner_Hierarchy_#=PID#")
                    .Columns(columns =>
                    {
                        columns.Bound(c => c.PID).Title("PID");
                        columns.Bound(c => c.ERPNME).Title("ERP");

                        columns.Command(command => { command.Edit(); });
                    })
                    .Width("600")
                    .DataSource(datasource => datasource
                        .Ajax()
                        .Model(model =>
                        {
                            model.Id(p => p.PID);
                            model.Field(p => p.ERPNME);
                            model.Field(p => p.SUBSFLAG);
                            model.Field(p => p.PROVFLAG);
                        })
                        .Read(read => read.Action("Read", "CCPartner", new { values = new string[] { "#=PID#" } }))

                        .Create(create => create.Action("Insert", "CCPartner"))
                        .Update(upd => upd.Action("Update", "CCPartner"))
                        .Destroy(del => del.Action("Delete", "CCPartner"))
                    )
                    .ToClientTemplate())
                </text>);

            tabs.Add().Text("Alias").Content(@<text>
                @(Html.Kendo().Grid<CCPartnerAliasDto>()
                .Name("Grid_CCPartnerAlias_Hierarchy_#=PID#")
                .Columns(columns =>
                {
                            columns.Bound(c => c.PID).Title("PartnerId").Width(200).Locked(true).Editable("notEditable");

                            columns.Command(command => { command.Edit(); command.Destroy(); });
                        })
                .ToolBar(toolbar => { toolbar.Create(); })
                .DataSource(datasource => datasource
                    .Ajax()

                    .Model(model =>
                    {
                        model.Id(p => p.PID);
                    })

                    .Read(read => read.Action("Read", "CCPartnerAlias", new { values = new string[] { "#=PID#" } }))

                    .Create(create => create.Action("Insert", "CCPartnerAlias"))
                    .Update(upd => upd.Action("Update", "CCPartnerAlias"))
                    .Destroy(del => del.Action("Delete", "CCPartnerAlias"))

                    .Filter(f => f.Add(val => val.RCDSTS).IsEqualTo(" "))

                    .PageSize(30))
                .Pageable()
                .Selectable()
                .Sortable()
                .Resizable(rs => rs.Columns(true))
                .ToClientTemplate())
                </text>);
        })
        .ToClientTemplate())


The Controller Base Class:
(where all three shown grid-controllers are derived from)

using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using Microsoft.AspNetCore.Mvc;
using WEB.BIM.DataLayer.Interface;
using WEB.BIM.DataLayer.Model.Application;
using WEB.BIM.DataLayer.Service;

namespace WEB.BIM.Controllers.Base
{
    public class ItemBaseController<TService, TModel> : BaseController<TService>
        where TService : IItemBaseService<TModel>
    {
        public ItemBaseController(ILogger logger, TService dataservice) : base(logger, dataservice)
        { }

        public async Task<ActionResult> Read([DataSourceRequest] DataSourceRequest request, params string[] values)
        {
            var result = await service.GetAsync(values);

            return Json(result.ToDataSourceResult(request));
        }
        public async Task<ActionResult> Insert([DataSourceRequest] DataSourceRequest request, TModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                await service.InsertAsync(model, UserName());
            }

            return Json(new[] { model }.ToDataSourceResult(request));
        }
        public async Task<ActionResult> Update([DataSourceRequest] DataSourceRequest request, TModel model)
        {
            if(model != null && ModelState.IsValid)
            {
                await service.UpdateAsync(model, UserName());
            }

            return Json(new[] { model }.ToDataSourceResult(request));
        }
        public async Task<ActionResult> Delete([DataSourceRequest] DataSourceRequest request, TModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                await service.DeleteAsync(model, UserName());
            }

            return Json(new[] { model }.ToDataSourceResult(request));
        }

    }
}

Any help appreciated

 

EDIT:

Huh, I just revisited my code and found the problem

1. The problem happens in hierarchical sub grids, because if i initialize the grids I set the DefaultValue of the id field to my parent id via js event like

    

// get detailGrids_subSelect

$.each(detailGrids_subSelect, function (index, value) { var tmp = value.getKendoGrid(); tmp.setOptions({ dataSource: { schema: { model: { fields: { PID: { defaultValue: e.data.PID } } } } } }) })

2. In another Grid where the id field is string i can just set it like this in datasource.model:

.Model(model =>
{
  model.Id(p => p.ALIASQLF);
  model.Id(p => p.ALIASVAL);
  model.Field(f => f.ALIASQLF).DefaultValue("#=ALIASQLF#");
})

Sadly the id field is a decimal and so i can not use the second approach, because it only allows string

Funny, that it works in the second part just fine, but in the first it recognizes, that the default value is equal to the id and then fires an insert instead of an update, if I exclude the grid in the first approach the update works as expected

But I will just remove the defaultValue in the first approach and do a custom create function where i set the parent id in the function or something like this

 

 

 

Felix
Top achievements
Rank 1
Iron
 updated question on 28 Dec 2023
1 answer
121 views

Hi, I have this Grid which uses Custom Binding for manual skip and take on the server.

After successful Read of data, my problem now is the Search and Filtering feature is now working.

 

 

@(Html.Kendo().Grid<MyWebApp.Web.Models.ViewModel>()
        .Name("grid")
        .EnableCustomBinding(true)
        .Columns(columns =>
        {
            columns.Bound(p => p.Sorting).Width(100).Filterable(false);
            columns.Bound(p => p.Code).Width(200).Filterable(true);
            columns.Bound(p => p.Description).Filterable(true);
        })
        .ToolBar(toolbar =>
        {
            toolbar.Search();
        })
        .Filterable()
        .Pageable()
        .Sortable()
        .Scrollable(scr => scr.Height(550))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Events(events => events.Error("error_handler"))
            .Model(model => model.Id(p => p.Id))
            .Read("gridDataSource", "Home")
        )
)
Alexander
Telerik team
 answered on 26 Dec 2023
1 answer
800 views
Good day Telerik Community.

Just recently our team started migrating most of our products to .NET 8 to align ourselves with the new release. However, when installing the updated Microsoft packages (or when trying to update ourselves to the new releases of Telerik), there seems to be a package conflict between Microsoft.EntityFrameworkCore.Tools and Telerik's UI For Asp.Net Core. Both packages use Microsoft.CodeAnalysis (the latter internally) but with different versions (4.5.0 or higher and 4.4.0 respectively).

Here's the error:
NU1107: Version conflict detected for Microsoft.CodeAnalysis.CSharp.Workspaces. Install/reference Microsoft.CodeAnalysis.CSharp.Workspaces 4.5.0 directly to project projectname to resolve this issue. 

Microsoft.EntityFrameworkCore.Tools 8.0.0 -> Microsoft.EntityFrameworkCore.Design 8.0.0 -> Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.5.0) 

Telerik.UI.for.AspNet.Core 2023.3.1129-Internal -> Microsoft.CodeAnalysis 4.4.0 -> Microsoft.CodeAnalysis.CSharp.Workspaces (= 4.4.0).


Both Telerik's latest releases (2023.3.1010 and
2023.3.1114) do not address or resolve this issue, and i didn't see a lot of post regarding it either (I've only found one single post. I'm linking it below for those interested)
Since that post's last message is dated more than a month ago, i'm asking if a solution was actually found or we just have to wait for the next stable release from Telerik (we've also tried using even the pre-release version, but nothing changed)
 
.Net 8 compatibility in UI for ASP.NET Core | Telerik Forums
Alexander
Telerik team
 answered on 25 Dec 2023
1 answer
74 views

Hi!

I've stumbled upon an issue with positioning of resize handlers for an image placed inside a table.
The resize handlers appears above the table altogether.

Steps to replicate:

Expected behaviour:

  • Select image
  • Resize handlers appear along the edge of the image

I have replicated the same problem in Chrome, Edge, Opera and Firefox.

See attached image for more details.

 

Is this something you are looking into, or should i try to make my own fix?
If you are looking into this, when could I expect a possible fix?

Kindest regards,
Tobias Nordby

Mihaela
Telerik team
 answered on 20 Dec 2023
1 answer
137 views

I am trying to get the export PDF of my grids to have the heads repeated on each page. Following the awful documentation I have been unable to get it to work. Some of the other functions work and others are ignored, however I'm only concerned about the headers. 

Here is my grid code:

		@(Html.Kendo().Grid<TheGridName>()
				.Name("mainGrid")
				.HtmlAttributes(new { @class = "gridHeight"})
				.Columns(col =>
				{
					col.Bound(c => c.col1).Title("Test 1");
					col.Bound(c => c.col2).Title("Test 2");
					col.Bound(c => c.col3).Title("Test 3");
					col.Bound(c => c.col4).Title("Test 4");
					col.Bound(c => c.col5).Title("Test 5");
					col.Bound(c => c.col6).Title("Test 6").;
				})
				.ToolBar(toolbar =>
				{
					toolbar.Excel();
					toolbar.Pdf();
				})
				.Pdf(pdf => pdf
					.AllPages(true)
					.AvoidLinks(false)
					.PaperSize("8in" , "11.5in")
					.Margin("2cm", "1cm", "1cm", "1cm")
					.Landscape(true)
					.Scale(0.8)
					.RepeatHeaders(true)
					.FileName("Kendo UI Grid Export.pdf")
					.ProxyURL(Url.Action("Pdf_Export_Save", "Grid"))
				)
				.Sortable()
				.Scrollable()
				.Filterable()
				.Resizable(r => r.Columns(true))
				.Reorderable(r => r.Columns(true))
				.Excel(excel => excel
				.FileName("test.xlsx"))
				.Events(x =>
				{
					x.ExcelExport("excelExport");
				})
				.ColumnMenu()
				.DataSource(ds => ds.Ajax()
				.Read(r => r.Url($"?handler=Read").Data("dataFunction"))
				.ServerOperation(false)
				))
Nothing fancy, just basic out of the box stuff. 

My Kendo and other important includes:
<script src="https://kendo.cdn.telerik.com/2023.1.314/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.1.314/js/kendo.aspnetmvc.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>

I'm guessing, like a lot of other features, this doesn't work in ASP.NET Core and this is some kind of copy paste error on Telerik's part and this only works in the jQuery version or something. 
Stoyan
Telerik team
 answered on 19 Dec 2023
1 answer
353 views

I have a breadcrumb control with 4 items, but the 2nd item is not shown (set to display: none). I saw in another forum post that some items will not be displayed if there is not enough room but that's not the case here. It's inside <ul class="navbar-nav flex-grow-1">

Also, I noticed that press F12 to open developer tools causes one of the items to disappear. Closing developer tools does not bring it back.

How can I ensure that all breadcrumb items are displayed?

Thanks

Mihaela
Telerik team
 answered on 18 Dec 2023
1 answer
88 views

Here is my grid:

@(Html.Kendo().Grid<AssetViewModel>()
      .Name("grid")
      .Columns(columns =>
       {
           columns.Bound(e => e.AssetId).Title("Asset").ClientTemplate(Html.Kendo().Template().AddComponent(avatar => avatar
                                                                                                                     .Avatar()
                                                                                                                     .Name("avatar_${data.AssetId}")
                                                                                                                     .Type(AvatarType.Image)
                                                                                                                     .Size(ComponentSize.Large)
                                                                                                                     .Rounded(Rounded.Full)
                                                                                                                     .Image(@Url.Action("GetFile", "MediaStore", new { fileId = "${data.LogoId}" }))
                                                                                                           )).Width(110);
           columns.Bound(e => e.AssetName).Title("Full Name").Width(200);
       })
      .Sortable()
      .Pageable()
      .Scrollable()
      .HtmlAttributes(new { style = "height:430px;" })
      .DataSource(dataSource => dataSource
                               .Ajax()
                               .PageSize(5)
                               .Read(read => read.Action("AssetListData", "Revenue"))
                 )

)

I have tried specifying as "#:AssetId#", "#=AssetId#" , and ${data.LogoId} but the parsing is not correct at runtime:

<span class="k-avatar-image"><img src="/MediaStore/GetFile?fileId=$%7Bdata.AssetId%7D"></span>

Ho do I get the LogoId properly?

Alexander
Telerik team
 answered on 14 Dec 2023
1 answer
404 views

Hi Telerik Team

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

Is this package ready for EF Core 8 ?

When I updated package Microsoft.VisualStudio.Web.CodeGeneration.Design
from version 7.x.x to version 8.0.0
I had to additionally install packages
Microsoft.CodeAnalytics.CSharp.Workspaces
Microsoft.CodeAnalytics.Workspaces.Common
Microsoft.CodeAnalytics.CSharp
Microsoft.CodeAnalytics.Common 4.8.0
because of Telerik.

I didn't need these packages before

Mihaela
Telerik team
 answered on 13 Dec 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?