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

I have a MVC Core project which has a Grid.  It is a hierarchal grid with a child grid.  Combined they show your basic orders and history of orders.  The grid fully populates and pages.  My problems lie with the editing side of things.

I am using a pop up editor.  A editor template is used and effectively gathers users edits.  The update side of things works flawlessly.  By this I mean you click Edit, the edit occurs, you press the save and the database gets updated.  The update method receives the "model" values entered during the edit action.  This is "as expected".

My problem exists with the Create action.  Both the Update and Create use the same editor.  Visually the Create editor accepts user input however when the "Create" action is called, the server method receives a model with null values for all the values entered.  Not a single entered value is returned in the model.  No errors are present in the developer console., non are occurring in any code I have control over.  I simply cannot explain the lack of values in the model.

I have compared the "Request.Form" values in the Update vs Create methods.  My Update methods request has FORM values in approximately 107 keyvalue pairs.  When the Create methods are used it gets 47 items.  Those 47 are all the default values of the model.  (I added default values to the datasource model to test this.  Those values arrive in the model, not the entered values)

Can anyone point me to the differences between the Update/Create actions?  Can anyone point me to a path to find/solve my problem?

Thanks for any suggestions.

 
Alexander
Telerik team
 answered on 28 Jun 2023
0 answers
463 views

Hi,

We have a Kendo Grid bound to a ViewModel with a string value that can be null. If we use NullValueHandling.Include in our MVC project Startup NewtonsoftJson.SerializerSettings:

.AddNewtonsoftJson(o =>
{
    o.SerializerSettings.ContractResolver = new DefaultContractResolver();
    o.SerializerSettings.NullValueHandling = NullValueHandling.Include;
})

this results in the null value being included in the Grid Multi Filter (see attached). If we use NullValueHandling.Ignore, this results in no value being included in the Grid Multi Filter and we can't filter on empty values. This seems odd, as the Grid is bound to a ViewModel which has the property declared on it. In KendoReact Grids, the value is correctly included in the Grid Multi Filter as 'undefined'  when using NullValueHandling.Ignore e.g. https://stackblitz.com/edit/react-ycmafw?file=app%2Fproducts.json.

  1. Is there any way to force the ASP.NET Core Grid to include the property as undefined?
  2. If not, is there any way to add a custom item to the Grid Multi Filter list that will match undefined values?

Kind regards,

David

David
Top achievements
Rank 1
Iron
Iron
Veteran
 asked on 26 Jun 2023
1 answer
69 views
currently i have a chart line and i have specified the color for each element in it from the store proc , but for some reason the lines connecting the timelines on the chart are different colors , only the The dot right at the landmark is the correct color I specified.
Here is my code

 @(Html.Kendo().Chart<Commsights.Data.DataTransferObject.DashbroadDataTransfer>()
                                                                .Name("LineChart_Customer_Processed")
                                                                .DataSource(dataSource => dataSource
                                                                .Read(read => read.Action("Chart_CountData_DaXuLyTolist", "Dashbroad").Data("FilterCompany"))
                                                                .Group(group => group.Add(model => model.CompanyName))
                                                                .Sort(sort => sort.Add(model => model.DatePublish).Ascending())
                                                                )
                                                                .Events(events => events.SeriesClick("onSeriesClick"))
                                                                .Theme("material")
                                                                .Series(series =>
                                                                {
                                                                    series.Line(model => model.ID_Count)
                                                                    .Name("#= group.value #")
                                                                    .Style(ChartSeriesStyle.Smooth)
                                                                    .CategoryField("DatePublish")
                                                                    .Tooltip(tooltip => tooltip
                                                                    .Visible(true)
                                                                    .Template("#= kendo.toString(category, 'MM/dd') # - #= value # (#= series.name # Article)"))
                                                                    .Width(3).Opacity(0.6)
                                                                   .ColorField("Color");
                                                                })
                                                                .Legend(legend => legend
                                                                .Position(ChartLegendPosition.Bottom)
                                                                )
                                                                .ValueAxis(axis => axis.Numeric()
                                                                .Labels(labels => labels
                                                                .Format("{0}")
                                                                .Skip(2)
                                                                .Step(2)
                                                                )
                                                                )
                                                                .CategoryAxis(axis => axis
                                                                .BaseUnit(ChartAxisBaseUnit.Days)
                                                                .Labels(labels => labels
                                                                .DateFormats(formats => formats.Months("MM/dd"))
                                                                .Rotation(-45)
                                                                )
                                                                )
                                                                .HtmlAttributes(new { style = "width: 100%; height: 400px;" })
                                                                )
Please help me!
Georgi Denchev
Telerik team
 answered on 23 Jun 2023
2 answers
196 views
here is my code 
@(Html.Kendo().Chart<Commsights.Data.DataTransferObject.DashbroadDataTransfer>()
                                                                .Name("LineChart_Customer_Processed")
                                                                .DataSource(dataSource => dataSource
                                                                .Read(read => read.Action("Chart_CountData_DaXuLyTolist", "Dashbroad").Data("FilterCompany"))
                                                                .Group(group => group.Add(model => model.CompanyName))
                                                                .Sort(sort => sort.Add(model => model.DatePublish).Ascending())
                                                                )
                                                                .Events(events => events.SeriesClick("onSeriesClick"))
                                                                .Theme("material")
                                                                .Series(series =>
                                                                {
                                                                    series.Line(model => model.ID_Count)
                                                                    .Name("#= group.value #")
                                                                    .Style(ChartSeriesStyle.Smooth)
                                                                    .CategoryField("DatePublish")
                                                                    .Tooltip(tooltip => tooltip
                                                                    .Visible(true)
                                                                    .Template("#= kendo.toString(category, 'MM/dd') # - #= value # (#= series.name # Article)"))
                                                                    .Width(3).Opacity(0.6)
                                                                   .ColorField("Color");
                                                                })
                                                                .Legend(legend => legend
                                                                .Position(ChartLegendPosition.Bottom)
                                                                )
                                                                .ValueAxis(axis => axis.Numeric()
                                                                .Labels(labels => labels
                                                                .Format("{0}")
                                                                .Skip(2)
                                                                .Step(2)
                                                                )
                                                                )
                                                                .CategoryAxis(axis => axis
                                                                .BaseUnit(ChartAxisBaseUnit.Days)
                                                                .Labels(labels => labels
                                                                .DateFormats(formats => formats.Months("MM/dd"))
                                                                .Rotation(-45)
                                                                )
                                                                )
                                                                .HtmlAttributes(new { style = "width: 100%; height: 400px;" })
                                                                )

I used colorfield() to specify the color of the elements on the chart but I don't understand why the dots at the landmarks are the correct color I specified to load from the store proc, but the lines connect them together wrong color.
Pls help me.
Alexander
Telerik team
 answered on 22 Jun 2023
1 answer
813 views
I am using the Image Browser in Kendo Editor for our Razor Pages and the images we upload are stored to a blob. But When I try to get the thumbnail using transport.thumbnail all I see is a loading wheel on the k-file-preview.
How do I get the thumbnail as a image preview instead of the spinning wheel.

Say I am uploading an Image - k-file-preview shows this link --> https://demos.telerik.com/aspnet-mvc/imagebrowser/thumbnail?path=thumbnail1.jpg
and upon insert the image into the editor the image url shows as --> https://demos.telerik.com/aspnet-mvc/content/userfiles/images/thumbnail1.jpg

does this mean we have thumbnails for the uploaded image stored in another folder, and upon calling thumbnail path it looks for the path n gives the preview??

then again for asp .net core i see k-listview-item i do not see a k-file-preview but on asp .net mvc and for jQuery I can see the thumbnail on demo -->  https://demos.telerik.com/aspnet-mvc/editor/imagebrowser

Mihaela
Telerik team
 answered on 20 Jun 2023
1 answer
995 views

Hello good day.

I have a KendoGrid where there are two rows for each record, the first two fields are repeated, I would like to merge two cells and make a single row with them, but the rest of the fields belonging to those records remain in their two different rows.

I show how it looks right now:

 

I show how I want it to look:

 

Thank you so much.

Alexander
Telerik team
 answered on 20 Jun 2023
1 answer
362 views

Hi, I want to create a shared data source that I can then apply filtering to. This data source should be initialised from a property on the Razor page model.

With a Grid you can do this:

Html.Kendo().Grid(Model.Devices)

But I can't figure out the equivalent for the DataSource. This is not allowed...

Html.Kendo().DataSource<DeviceAggregate>(Model.Devices)
                .Name("devicesDataSource")

 


Stoyan
Telerik team
 answered on 19 Jun 2023
1 answer
232 views

We have a custom command in a UI for ASP.NET Core FileManager control that states the icon as a simple textual name which worked fine in 2023.1.117


items.Add("").Type("button").Name("refresh").Icon("reload").Text("Refresh").Click("onRefresh").HtmlAttributes(new { style = "margin-left: 5px;" });
After upgrading to 2023.2.606 the icon no longer shows so am curious how the icon should now be referenced.  I've tried using k-svg style class names but to no avail and even using SpriteCssClass with FontAwesome classes is not working.  Could the Custom Command demo for the FileManager be tweaked to show a custom command with a custom icon in the manner that is required for the new SASS + FontIcon + SvgIcon based builds of UI for ASP.NET Core.
Stoyan
Telerik team
 answered on 19 Jun 2023
1 answer
175 views

Hi All,
I have a problem. I've a not working grid. I do a compilated query for get the data but the data never gets loaded in the grid.

What is the error? Thanks in advance for any help.

Content of controller 
using DataLayerIAccess.Repository;
using DataLayerIAccess.Repository.Queries;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Threading.Tasks;
using WebViewerIAccess.Models;

namespace WebViewerIAccess.Controllers
{
    public class GridController : Controller
    {
        private readonly IAccessDbContext _context;


        public GridController(IAccessDbContext context)
            => _context = context;


        public async Task<IActionResult> ElencoPresenze_Read([DataSourceRequest] DataSourceRequest request)
        {
            var elencoPresenze = (await _context.GetElencoPresenze(0, 10)).ToList();
            var presenzeViewModel = Utilities.MapFromAType<PresenzeModel>(elencoPresenze);

            var dsResult = presenzeViewModel.ToDataSourceResult(request);
            return Json(dsResult);
        }

Content of .cshtml

@{
    ViewData["Title"] = "Presenze";
}

<div class="text-center">
       @(Html.Kendo().Grid<WebViewerIAccess.Models.PresenzeModel>()
        .Name("grid")
        .Columns(c => {
            c.Bound(p => p.ID);
            c.Bound(p => p.Nome);
            c.Bound(p => p.Cognome);
            c.Bound(p => p.Giorno);
            c.Bound(p => p.Reparto);
        })        .Pageable(p => p
            .PageSizes(new[] { 10, 20, 50 })
            .Refresh(true)
            .Responsive(true))
            .Sortable()
        .Filterable()
        .Scrollable()
        .Groupable()
        .DataSource(ds => ds
            .Ajax()
            .Batch(true)
            .PageSize(20)
            .AutoSync(true)
            .ServerOperation(false)
            .Events(e => e.Error("error_handler"))
            .Model(m => {
                m.Field(p => p.ID);
                m.Field(p => p.Nome);
                m.Field(p => p.Cognome);
            })
            .AutoSync(true)
            .Read(r => r.Action("ElencoPresenze_Read", "Grid"))
</div>

<script type="text/javascript">
    function error_handler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script>

Content of Model
using System;

namespace WebViewerIAccess.Models
{
    public class PresenzeModel
    {
        public int ID { get; set; }
        public string Nome { get; set; }
        public string Cognome { get; set; }
        public DateTime Giorno { get; set; }
        public string Reparto { get; set; }
    }
}

 

thank you

      
Aleksandar
Telerik team
 answered on 16 Jun 2023
1 answer
163 views

I am relatively new to ASP.Net core (.net6) and I am trying to bind the Kendo scheduler with my existing data source.

Background: I am tasked with replacing outdated javascript tools for our "shipping scheduler", which is very similar to the Telerik Scheduler Timeline view.

Here is an example of what I am trying to achieve...

 

The data source is a simple API source from the web (for example https://mydomain.com/datasource), with the following structure:

 

namespace ShippingSchedulerApp.Models
{
    public class SchedulerEvent
    {
        public long ID { get; set; }
        public DateTime? start_date { get; set; }
        public DateTime? end_date { get; set; }
        public string? text { get; set; }
        public string? shipclass { get; set; }
        public decimal? beam { get; set; }
        public string? sectionID { get; set; }
        public string? flag { get; set; }
        public string? country { get; set; }
        public string? visitnumber { get; set; }
        public int? visitid { get; set; }
        public int? imo { get; set; }
        public string? details { get; set; }
        public string? cargo { get; set; }
        public decimal? duration { get; set; }
        public decimal? loa { get; set; }
        public string? stevedore { get; set; }
    }
}

If someone could point me to a demo or a sample way of connecting the above to the Telerik Scheduler Timeline view, that would be great.

Thanks

 

Stoyan
Telerik team
 answered on 15 Jun 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?