Telerik Forums
UI for ASP.NET Core Forum
1 answer
434 views
I am using Telerik.UI.for.AspNet.Core version 2023.1.314 in .NET Core project which uses System.Reflection.TypeExtensions. The deployed version is working fine but occasionally it give me error  Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.1.0.0. After restart of app pool it works fine again. Not sure what the problem is. Please help. Thank you
Anton Mironov
Telerik team
 answered on 23 Feb 2024
0 answers
59 views
How to use WorkWeekStart and what does it do? What are the valid integer values? 0 to 6? 1 to 7? The month view is rendered Sunday to Saturday... If I need to display Monday to Sunday would the changing the WorkWeekStart help? It doesn't seem to do anything.
Francis
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 20 Feb 2024
1 answer
260 views

Hello,

I have Html.Kendo().Grid with checkbox column based on field(IsEnabled) is true that particular grid cell with check box needs to allow the user selection. if field(IsEnabled) is false that particular cell should be disabled and not allow the user to select or deselect.

The issue I'm facing is, it is allow to select the check box in second click only. not allowing to select in single click on that check box

sample code which I am using:

columns.Bound(c => c.IsEnabled)
    .Title(Localizer["EnableDisableFlag", "PSFPro"].Value)
    .ClientTemplate("<input type='checkbox' class='check-state enableDisableFlagCB'" +
        $"onclick = 'handleEnableDisableFlagCheckBoxClicked(this);'" +
        $"#= {nameof(TransactionTypeMappingParameterViewModel.IsEnabled)} ? " +
        "'checked=checked' : '' # />")
        .Sortable(false);
Mihaela
Telerik team
 answered on 19 Feb 2024
1 answer
1.0K+ views

I've pulled ViewModel objects into my selectable grid. After a user selects rows, a submit button allows an ajax call which will post the selected objects (rows) to a controller method: 

    function submitAddressImport() {
         var grid = $("#groupAddressesImportGrid").data('kendoGrid');
         var selectedItems = grid.selectedKeyNames();
         var actualItems = [];

         if (selectedItems.length > 0) {
           selectedItems.forEach(function(key) {
            actualItems.push(grid.dataSource.get(key));
           });
         }

        kendo.ui.progress($("#groupAddressesImportGrid"), true);
        for (var i = 0; i < actualItems.length; i++) {
                $.ajax({
                type: "POST",
                url: "@Url.Action("AddAddress", "Address")",
                contentType: "application/json;",
                data: actualItems[i],  // JSON.stringify(actualItems[i]) avoids console error
                traditional: false,
                success: function (data) {
                 ...
                },
                error: function (data) {
                  ...
                },
                timeout: function (data) {
                   ...
                }, complete: function () {
                   ...
                }
            });
        }
        closeGroupAddresspopup()
    }

What is most curious about this error is that it is avoided if I use JSON.stringify() to convert the object to a JSON string. My model expects an object of a class, and if a stringified object is sent the object itself will not be null but will have all properties set to null.

When troubleshooting this, I removed the call to JSON.stringify() and encountered the console error: 

Uncaught TypeError: Cannot read properties of undefined (reading 'field')

Why does this error occur when JSON.stringify() is not used, and how can it be avoided? 

My grid is configured as follows:


            @(
                Html.Kendo().Grid(Model.groupAddresses)
                .Name("groupAddressesImportGrid")
                .HtmlAttributes(new { @class = "table-cell" })
                .Columns(columns =>
                {
                    columns.Select().Width(50);
                    columns.Bound(obj => obj.AddressType).Title("Type").Width(60);
                    columns.Bound(obj => obj.PrimaryField).Title("Primary");
                    columns.Bound(obj => obj.Address1).Title("Address");
                    columns.Bound(obj => obj.AddressCity).Title("City");
                    columns.Bound(obj => obj.State).Title("State");
                    columns.Bound(obj => obj.ZipCode).Title("Zip Code");
                    columns.Bound(obj => obj.County).Title("County");
                })
                .Sortable(_ => _.AllowUnsort(true))
                .Resizable(resizable => resizable.Columns(true))
                .Navigatable()
                .Filterable()
                .Scrollable()
                .Resizable(resize => resize.Columns(true))
                .Events(ev=>ev.Change("handleCheckBox"))
                .PersistSelection()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Model(model => model.Id(p => p.AddressId)) 
                )
                )

Mihaela
Telerik team
 answered on 19 Feb 2024
0 answers
102 views

I'm using a Razor partial to create a navigation menu being served from a database. It's rendering the data from the database without issue, however, the children items are being displayed instead of only showing on hover / click.

When I load the app, the children items are already showing and attempting to collapse the About Root by clicking it has no result. Is it possible that the issue is related to Partial rendering?

@using Data.Tables
@using Data.Repositories
@using Microsoft.Extensions.Caching.Memory
@using Kendo.Mvc.UI
@inject NavigationRepository NavigationRepository
@inject IMemoryCache memoryCache

 

if (memoryCache.TryGetValue(NavigationRepository.cacheKey, out List<Navigation> navItems))
{
@(
                Html.Kendo().Menu()
                        .Name("navigation")
                        .Items(items =>
                        {  //Render data that is loaded into .NET IMemoryCache on startup and kept up-to-date through the repository
                            foreach (var nav in navItems.Where(q => q.ParentNavigationId == null)) //Renders top level objects only
                            {
                                items.Add()
                                    .Text(nav.Text)
                                    .Url(nav.Link)
                                    .Items(children =>
                                    { //Render child objects by matching elements that reference the top level object Id
                                        foreach (var subNav in navItems.Where(q => q.ParentNavigationId == nav.Id))
                                        {
                                            children.Add()
                                                .Text(subNav.Text)
                                                .Url(subNav.Link);
                                        }
                                    });
                            }
                        })
                        .Direction(MenuDirection.Bottom)
                        .Orientation(MenuOrientation.Horizontal)
                        .OpenOnClick(true)
                        .CloseOnClick(true)
                        .HoverDelay(100)
                        .Animation(a =>
                        {
                            a.Enable(true);
                            a.Open(effect =>
                            {
                                effect.Expand(ExpandDirection.Vertical);
                                effect.Duration(500);
                            });
                            a.Close(effect =>
                            {
                                effect.Duration(300);
                            });
                        })
                        .Deferred(true) // JS error of kendo not found if this is not enabled
)
}

 

This partial is then rendered into the _Layout.cshtml through the below code.

<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
    <partial name="_NavigationPartial" />
    <partial name="_LoginPartial" />
</div>
Tyler
Top achievements
Rank 1
 asked on 18 Feb 2024
2 answers
122 views

When row dragging and dropping the second time the UI doesnt refelct the change.

If I have an event I can see the drag and drop correctly, but the UI leaves the dragged row where it was

the code is simple

@(Html.Kendo().Grid<OncostVM>()
    .Name("OncostGrid")
    .DataSource(data => data
        .Ajax()
        .Read(read => read.Action("Read", "Oncost"))
        .PageSize(10)
    )
    .Columns(columns =>
    {
        columns.Bound(c => c.OncostId).Title("Id").Width(80).Filterable(false);
        columns.Template(@<text> </text>).Draggable(true).Width(50);
        columns.Bound(c => c.Name).Filterable(false);
        columns.Bound(c => c.Visible).Width(120).Filterable(false).YesNo("Visible");
        columns.Bound(c => c.Active).Width(120).YesNo("Active");
    })
    .Filterable()
    .Sortable()
    .Pageable(page => page.Refresh(true))
    .Reorderable(order => order.Rows(true))
    @* .Events(ev => { ev.RowReorder("dragRow"); }) *@
)

https://i.imgur.com/GiD6Pi2.gif

 

Ivan Danchev
Telerik team
 answered on 13 Feb 2024
1 answer
128 views

Hi!

I use a lot of forms (created using HtmlHelper) inside templates used by various other elements (mainly inside TileLayouts).

e.g.:

public record SettingsViewModel
{
    [DataType(DataType.Password)]
    public string Password { get; set; } = null!;
}
<script id="settings-template" type="text/x-kendo-template">
    @(Html.Kendo().Form<settingsViewModel>()
        .Name("settingsForm")
        .FormData(Model.Settings)
        .Layout("grid")
        .Grid(g => g.Cols(2).Gutter(5))
        .HtmlAttributes(new { method = "POST", style = "width: 100%;" })
        .Validatable(v =>
        {
            v.ValidateOnBlur(false);
            v.ValidationSummary(true);
        })
        .Items(items =>
        {
                
            items.Add().Field(f => f.Password).Label("Password");
        })
        .ToClientTemplate()
        @* .ToString()
        .Replace("#", "\\#") *@
    )
</script>
<div class="k-d-flex-col k-justify-content-center">
    @(Html.Kendo().TileLayout()
        .Name("settings")
        .Columns(5)
        .RowsHeight("auto")
        .Containers(c =>
        {
            ...
            c.Add().BodyTemplateId("settings-template").ColSpan(4).RowSpan(1);
            ...
        })
    )
</div>

Many of these forms requires to accept text boxes (like passwords) which should accept "#"  in their content. 

Saving works perfect but when rendering the Form I always get an exception. Please see below error:

Uncaught Error: Invalid template:'
        <form id="settingsForm" method="POST" name="settingsForm" style="width: 100%;"></form><script>kendo.syncReady(function(){jQuery("\#settingsForm").kendoForm({"validatable":{"validateOnBlur":false,"validationSummary":{}},"formData":{"Password":"bla#bla","Id":0},"layout":"grid","grid":{"cols":2,"gutter":5},"serverErrors":{},"items":[{"field":"Password","label":{"text":"Password"},"editorOptions":{},"validation":{"data-val":"true","data-val-required":"The Password field is required.","type":"password"},"shouldRenderHidden":true}]});});<\/script>
    ' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='\n        <form id="settingsForm" method="POST" name="settingsForm" style="width: 100%;"></form><script>kendo.syncReady(function(){jQuery("#settingsForm").kendoForm({"validatable":{"validateOnBlur":false,"validationSummary":{}},"formData":{"Password":"bla';bla","Id":0},"layout":"grid","grid":{"cols":2,"gutter":5},"serverErrors":{},"items":[{"field":"Password","label":{"text":"Password"},"editorOptions":{},"validation":{"data-val":"true","data-val-required":"The Password field is required.","type":"password"},"shouldRenderHidden":true}]});});<\/script>
    ;$kendoOutput+=;}return $kendoOutput;'
    at Object.compile (kendo.all.js:322401:19)
    at init._initContainers (kendo.all.js:322401:19)
    at new init (kendo.all.js:322401:19)
    at HTMLDivElement.<anonymous> (kendo.all.js:322401:19)
    at Function.each (jquery.min.js:2:2898)
    at n.fn.init.each (jquery.min.js:2:846)
    at e.fn.<computed> [as kendoTileLayout] (kendo.all.js:322401:19)
    .......

Any idea how to fix that on the client-side (and not need to escape each property I want to accept "#" at server-side) ? 

Thanks

Alexander
Telerik team
 answered on 13 Feb 2024
0 answers
156 views
Has anyone or does anyone do anything to secure their license file outside of what Telerik recommends?  This way the plain text file isn't just available to anyone accessing your website.
Christopher
Top achievements
Rank 1
 asked on 06 Feb 2024
1 answer
188 views
System.Drawing is not support in linux OS
Anton Mironov
Telerik team
 answered on 05 Feb 2024
0 answers
103 views

Hello,

I want to ask how to upload a TIFF image and show it using ImageEditor, i tried the Demo page on ASP.NET Core ImageEditor Key Features Demo | Telerik UI for ASP.NET Core but the TIFF not showing.

Is it not supported ? are there any workaround ?

 

Thanks.

Mozart
Top achievements
Rank 1
Iron
Veteran
 asked on 05 Feb 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?