Telerik Forums
UI for ASP.NET Core Forum
3 answers
417 views

All,

I am having a heck of a time with a very basic implementation using custom Ajax binding.

My implementation is extremely simple. I have verified that the JSON result is returned as CamalCase (Hence the KendoSerializerSettings).

Please see below.

Controller

public ActionResult YearRead([DataSourceRequest]DataSourceRequest request)
        {
            IEnumerable<VehMetaYearDto> years = _metaService.GetYears();
 
            DataSourceResult result = years.ToDataSourceResult(request);
 
            return Json(result, KendoSerializerSettings);
        }

 

JSON Result

{
  "Result": {
    "Data": [
      {
        "Year": 2017,
        "IsDeleted": false,
        "DeleterUserId": null,
        "DeletionTime": null,
        "LastModificationTime": null,
        "LastModifierUserId": null,
        "CreationTime": "2018-10-30T12:15:48.1414343",
        "CreatorUserId": null,
        "Id": 1
      },
      {
        "Year": 2016,
        "IsDeleted": false,
        "DeleterUserId": null,
        "DeletionTime": null,
        "LastModificationTime": null,
        "LastModifierUserId": null,
        "CreationTime": "2018-10-31T08:14:16.9153819",
        "CreatorUserId": null,
        "Id": 2
      }
    ],
    "Total": 2,
    "AggregateResults": null,
    "Errors": null
  },
  "TargetUrl": null,
  "Success": true,
  "Error": null,
  "UnAuthorizedRequest": false,
  "__abp": true
}

 

Razor

@(Html.Kendo().Grid<VehMetaYearDto>()
.Name("YearGrid")
.Columns(c =>
 {
      c.Bound(x => x.Year);
  })
 .DataSource(d => d
   .Ajax()                              
   .Read(r => r.Action("YearRead", "VehMetaAdmin"))
     )
   )

 

The grid renders blank sadly.

PS - The code formatting for this forum is very difficult to use

Alex Hajigeorgieva
Telerik team
 answered on 05 Nov 2018
1 answer
102 views

I am using core 2.1. Attempting to use tag-helpers, but documentation is pretty bad. 

We have a grid mostly working for when there is an existing object, but I don't see a way to use the grid for something new.  

For example, if my page is creating a new client, and I'm using the grid for a list of phone numbers, I don't want the grid to go to the server with new entries (create operations), because the client does not exist yet.  

Is there a way to add items to the grid in an offline fashion, then bind the data to the model and post the list back with all the other client information? 

I want one endpoint for a "New Client" operation that can perform all the validation in one sweep, including validating phone numbers.  

Tsvetina
Telerik team
 answered on 05 Nov 2018
3 answers
3.2K+ views

Hi! My app uses Razor Pages and I'm trying to do the following:

1. Open a modal dialog, which is itself a Razor Page with a model.

2. Submit from that modal dialog and call the OnPost method in its model. 

When I click submit, it simply closes the dialog and never calls the OnPost method.

Here's my code:

First, the calling page, Customer.cshtml:

@page
@addTagHelper "*, Kendo.Mvc"
@model MySite.Test.CustomerModel
@{
    Layout = null;
}
 
<!DOCTYPE html>
 
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Customer</title>
    <link href="//kendo.cdn.telerik.com/2018.3.1017/styles/kendo.bootstrap-v4.min.css" rel="stylesheet" />
 
</head>
<body>
    @{
        string[] actions = new string[] { "Close" };
    }
    <kendo-window name="window"
        modal="true",
        title="Add a New Customer"
        draggable="true"
        resizable="true"
        width="800" ,
        on-close="onClose" ,
        style="display:none" ,
        content-url="@Url.Content("/Test/AddCustomer")" ,
        actions="actions">
        <content>
            loading user info...
        </content>
        <popup-animation enabled="true" />
    </kendo-window>
 
    <button id="undo" class="btn btn-sm btn-outline-primary right">Click here to open the window.</button>
    <div class="responsive-message"></div>
    <script>
        function onClose() {
            $("#undo").show();
        }
 
        $(document).ready(function () {
            $("#undo").bind("click", function () {
                $("#window").data("kendoWindow").open();
                $("#window").data("kendoWindow").center();
                $("#undo").hide();
            });
        });
    </script>
</body>
</html>

It has a trivial page model, which I will not include here.

Then the Modal Dialog Page, AddCustomer.cshtml:

@page
@addTagHelper "*, Kendo.Mvc"
@model MySite.Test.AddCustomerModel
@{
    Layout = "";
}
 
<div class="container-fluid body-content">
    <form method="post">
        <div asp-validation-summary="All" class="text-danger"></div>
        <div class="form-group">
            <label asp-for="Customer.FirstName" class="control-label"></label>
            <input asp-for="Customer.FirstName" class="form-control" autofocus />
            <span asp-validation-for="Customer.FirstName" class="text-danger"></span>
        </div>
        <div class="form-group">
            <label asp-for="Customer.Middle" class="control-label"></label>
            <input asp-for="Customer.Middle" class="form-control" />
            <span asp-validation-for="Customer.Middle" class="text-danger"></span>
        </div>
        <div class="form-group">
            <label asp-for="Customer.LastName" class="control-label"></label>
            <input asp-for="Customer.LastName" class="form-control" />
            <span asp-validation-for="Customer.LastName" class="text-danger"></span>
        </div>
        <div class="form-group">
            <input type="submit" value="Create" class="btn btn-primary" />
        </div>
    </form>
</div>

and its non-trivial model, which contains the OnPost that is never being called:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
 
namespace MySite.Test
{
    public class AddCustomerModel : PageModel
    {
        [BindProperty]
        public AddCustomerViewModel Customer { get; set; }
 
        public void OnGet()
        {
            Customer = new AddCustomerViewModel();
        }
        public ActionResult OnPost()
        {

             // I am never getting to this method.

            if (ModelState.IsValid)
            {
                // Do some stuff
                return Redirect("/Test/Customer");
            }
 
            return Page();
        }
 
        public class AddCustomerViewModel
        {
            [MaxLength(256)]
            [Display(Name = "First Name")]
            [Required]
            public string FirstName { get; set; }
            [MaxLength(256)]
            [Display(Name = "Middle Name")]
            [Required]
            public string Middle { get; set; }
            [MaxLength(256)]
            [Display(Name = "Last Name")]
            [Required]
            public string LastName { get; set; }
 
        }
    }
}

 

I'm kinda stumped and the only example I can fine is for Razor Views, not Razor Pages. Please advise.

Thanks!

Laurie
Top achievements
Rank 1
Iron
 answered on 31 Oct 2018
1 answer
215 views

Hello,

With the new Material Theme, how can we have floating labels on Telerik controls (dropdownlist, combobox, ...) ?

 


Dimitar
Telerik team
 answered on 31 Oct 2018
1 answer
137 views

Hello,

Since I do not want a static value in my gauge, I want to use some model value. By checking the documentation of the gauge, there is none example to bind it with a model. Is there any example to perform this in asp.net core?  

Kind regards.

Konstantin Dikov
Telerik team
 answered on 31 Oct 2018
1 answer
151 views

Hello,

Ive been using multiple graphs now. Those are: bar, scatter and gauge. Now I when I resize my screen and reload my page. The bar and scatter chart will resize perfectly. Only the gauge will keep doing his own thing. How can I fix this, and could this be a feature to add so the scatter will resize when the page reloads/resizes.

 

Kind regards.

Preslav
Telerik team
 answered on 26 Oct 2018
1 answer
480 views

I wanted to use Telerik Asp.Net Core plugins in my project. When I am trying to copy the menu component of Telerik UI, it throws error on Basecontroller class and [Demo] annotations. Please let me know, what is this error about and how to fix it.

Veselin Tsvetanov
Telerik team
 answered on 26 Oct 2018
1 answer
384 views

Hi

I Have a grid like this :

01.@(Html.Kendo().Grid<TMain>()
02.                 .Name("gridEQ")
03.                 .Columns(c =>
04.                 {
05.                     c.Group(g =>
06.                         g.Title("History")
07.                             .Columns(i =>
08.                             {
09.                                 i.Bound(x => x.History.HairLoss).ClientTemplate("#= History.HairLoss ? 'Yes' : '' #");
10.                                 i.Bound(x => x.History.WT_Gain).ClientTemplate("#= History.WT_Gain ? 'Yes' : '' #");
11.                                 i.Bound(x => x.History.Wt_loss).ClientTemplate("#= History.Wt_loss ? 'Yes' : '' #");
12.                             })
13.                         );
14.                     c.Group(g =>
15.                         g.Title("PmhDh")
16.                             .Columns(i =>
17.                             {
18.                                 i.Bound(x => x.PmhDh.Levothyroxine);
19.                             })
20.                         );
21.                 })
22.                 .Sortable()
23.                 .Pageable()
24.                 .Scrollable()
25.                 .DataSource(d => d
26.                     .Ajax()
27.                     .PageSize(20)
28.                     
29.                     .ServerOperation(true)
30.                     .Read(r => r.Action("SendData", "MyAction"))
31. 
32.                 ))

I want hide columns if all cell of column was empty value and if all columns of a group was hide the column of group also hide too .

for example if Levothyroxine column data was empty string the Levothyroxine column hide and PmhDh hide too.

my problem is i have 230 columns that i must show in this grid and i want hide empty columns

Konstantin Dikov
Telerik team
 answered on 25 Oct 2018
1 answer
244 views

Hi,

I am trying to have a list of Offices for an Organisation edited from a tabstrip, i can load the data and perform modifications easily but my problem arises when i want to add a new office when i click on a button. i use the API to add a tab but i do not know if it is possible for me to specify that the content should be loaded from an action. 

Veselin Tsvetanov
Telerik team
 answered on 24 Oct 2018
1 answer
362 views

Hello Team;

Do we have a Kanban Widget in Kendo UI for ASP.Net Core 2.1?
I saw an application that had used Kendo UI jQuery widget and they told me their Kenban widget was from Telerik. However, when I look at t he list of ASP.Net core widgets I can't find any with that name.

Could you please shed some light where to find it?
Thanks!

Vessy
Telerik team
 answered on 24 Oct 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?