Telerik Forums
UI for ASP.NET Core Forum
1 answer
127 views
Agregue un kendo-datepicker en un proyecto principal asp.net, pero la ejecución del proyecto no muestra el objeto kendo, que debe hacerse
Anton Mironov
Telerik team
 answered on 16 Jul 2020
6 answers
314 views

Hi,

 

I have this config below for a treelist. You can see that I have enabled drag and drop by setting move to true.

I would expect, when I drag and drop an item from one parent to another, that the "update" action defined in my controller is hit with the model containing the parentId of the new parent, but the "update" action on the controller is not being hit !

What am I missing ?

@(Html.Kendo().TreeList<AccountGroupModel>()
              .Name("tlAccountGroup")
              .Toolbar(toolbar =>
              {
                  toolbar.Create();
              })
              .Columns(columns =>
              {
                  columns.Add().Field(f => f.Name);
                  columns.Add().Command(c =>
                  {
                      c.Edit();
                  });
              })
              .Editable(editable => editable.Move(true))
              .DataSource(datasource =>
                  datasource
                      .Model(model =>
                      {
                          model.Id(m => m.Id);
                          model.ParentId(m => m.ParentId);
                          model.Field(m => m.Name);
                      })
                      .Read(read => read.Action("AccountGroups_Read", "AccountGrouping"))
                      .Create(create => create.Action("AccountGroups_Create", "AccountGrouping"))
                      .Update(update => update.Action("AccountGroups_Update", "AccountGrouping"))
              ))

 

My controller actions look like this:

public async Task<JsonResult> AccountGroups_Read([DataSourceRequest] DataSourceRequest request)
        {
            var models = await accountGroupingService.GetAccountGroupsAsync();
            return Json(models.ToTreeDataSourceResult(request, e => e.Id, e => e.ParentId, e => e));
        }
 
        public async Task<JsonResult> AccountGroups_Create([DataSourceRequest] DataSourceRequest request, AccountGroupModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                model = await accountGroupingService.SaveAccountGroupAsync(model);
            }
 
            return Json(new[] {model}.ToTreeDataSourceResult(request, ModelState));
        }
 
        public async Task<JsonResult> AccountGroups_Update([DataSourceRequest] DataSourceRequest request, AccountGroupModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                model = await accountGroupingService.SaveAccountGroupAsync(model);
            }
 
            return Json(new[] { model }.ToTreeDataSourceResult(request, ModelState));
        }
Tsvetomir
Telerik team
 answered on 15 Jul 2020
2 answers
90 views

We have a situation when a user is using a filterable DropDownList they input part of the "contains" filter in the search bar "Hamilton," After 3 chars the filter starts to call the method to filter the results. While the user keeps entering data "Hamilton, Tim" the initial return values for the 1st 3 chars returns and they select a value from that list. Then the remaining value(s) return from the "Hamilton, Tim" query and clears out the selected value.

Is there a way to disable this from happening when they select a value and in effect disregard any additional filtering based on the fact that they selected a value

 

 

 

Martin
Telerik team
 answered on 15 Jul 2020
5 answers
239 views

Hi,

I am working on grid that runs with two views: all accounts and only favourites accounts. Grid has defined endless scrolling. When I switch this views after application start everything is OK. But when I load "next" accounts (by scrolling) view with favourites contains all accounts. I see data from read and there is correct number of accounts. It seems grid has some data from past. Is there any way how to refresh all grid data?

 

I tried clear data by

"$('#AccountGrid').data('kendoGrid').dataSource.data([]);"

but in favourite accounts view is nothing and in all account view only first page is reloaded by scrolling.

 

Thanks for any reply.

Nikolay
Telerik team
 answered on 14 Jul 2020
3 answers
95 views

I'm binding an AutoComplete to data server-side and it may, conditionally, already have a value set. I want to make sure that the user cannot add values that are not in the list so I've added a script that searches the dataSource for the value before the form is submitted. The problem seems to be when the textbox is given a value server-side, so it's never typed in or searched client-side before submitting, the dataSource .view() and .data() are empty (so it thinks my text is invalid). How can I get my dataSource to include the data without the user typing in the textbox?

01.@(Html.Kendo().AutoComplete()
02.    .Name("ac-selected-gym")
03.    .BindTo(Model.AvailableLocations)
04.    .DataTextField("GymName")
05.    .Filter("contains")
06.    .MinLength(1)
07.    .HtmlAttributes(new { @class = "form-control", data_selected_gym = "", aria_describedby = "selectedGymHelp" })
08.    .Placeholder("Select your gym")
09.    .Value(Model.AvailableLocations.Where(f => f.Id== Model.SelectedId).FirstOrDefault()?.GymName)
10.    .Events(e => e.Change("sso.saml2.onGymChange"))
11.    )

 

01.function getSelectedGym($flnAc) {
02.    var selectedGym;
03. 
04.    var value = $flnAc.value();
05.    var gymData = $flnAc.dataSource.view(); //This actually appears to return only the current match (or nothing)
06. 
07.    var searchSource = function (dataSource, gymName) {
08.        var matchedGym;
09.        for (var x = 0, length = dataSource.length; x < length; x++) {
10.            if (dataSource[x].GymName === gymName) {
11.                matchedGym = dataSource[x];
12.                break;
13.            }
14.        }
15.        return matchedGym;
16.    };
17. 
18.    selectedGym = searchSource(gymData, value);
19. 
20.    //dataSource.view() may not have our item in it e.g. if the textbox was pre-filled server-side rather
21.    //than typed client-side, so search the whole list if not found. (Couldn't find a way to tell the control to update its datasource)
22.    if (!selectedGym) {
23.        gymData = $flnAc.dataSource.data();
24.        selectedGym = searchSource(gymData, value);
25.    }
26. 
27.    return selectedGym;
28.}

 

As you can see I tried to work around .view() being empty but then found that .data() is also empty. I also tried triggering the change event on load, but it was still empty.

Martin
Telerik team
 answered on 14 Jul 2020
1 answer
148 views

Hi,
im working with scheduler component, and when i need to add an event, I need restrict the slot when itĀ“s already is used.

I have used occurrencesInRange method but I need to compare the hours too.

mainly my need is to restrict when I have the date and time busy, I have looked in examples and they only validate occurrence of day.

 

Thanks.

Aleksandar
Telerik team
 answered on 13 Jul 2020
4 answers
368 views

     I have implemented a simple Kendo grid in ASP .Net Core which should bind the data on DataSoruce Read request. In actual it is not binding data in read request but binds the data whenever i click on 'refresh' icon under pagination. Below is my code - 

 

<div class="grid-container">

        @(Html.Kendo().Grid<CAMPv2.Models.AutoPoco.Role>()
    .Name("RolesGrid")
    .Columns(columns =>
    {
        columns.Bound(c => c.Name);
        columns.Bound(c => c.NormalizedName);
        columns.Bound(c => c.Description);
        columns.Bound(c => c.Status);
    })    
    .Scrollable()
    .Sortable()
    .Pageable(pageable => pageable
    .Refresh(true)
    .PageSizes(true)
    .ButtonCount(5))
    .DataSource(datasource => datasource
    .Ajax()
    .Read(read => read.Action("GetRoles", "Role"))

    )
    )
    </div>

 

Below is code behind - 

[HttpPost]
        public IActionResult GetRoles([DataSourceRequest] DataSourceRequest request)
        {
            List<Role> _lrolePermissionDetails = _tableOperations.GetAll<Role>(ApplicationConstants.CONNECTOR_AUTOPOCOAUTH, "Role", _loggingService).ToList();
            return Json(_lrolePermissionDetails.ToDataSourceResult(request));           
        }

 

Please let me know what i am missing here.

Thanks,

Naga

 

 

Nikolay
Telerik team
 answered on 13 Jul 2020
2 answers
2.6K+ views

Hi Telerik,

When I use the "services.AddKendo();" command,the program gives the following message.

I have followed the instructions on your page, the situation has not changed.

I first tried it with version 2016.3.118, then I tried it with the latest promotional version, the message has not changed.

Best regards,

 

 

 

 

Mehmet Bingol

 

Exception Unhandled:

System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: 
Kendo.Mvc.Rendering.IKendoHtmlGenerator Lifetime: Transient ImplementationType: Kendo.Mvc.Rendering.KendoHtmlGenerator': 
Could not load type 'Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.5.0, 

InvalidOperationException: Error while validating the service descriptor 'ServiceType: Kendo.Mvc.Rendering.IKendoHtmlGenerator Lifetime: 
Transient ImplementationType: Kendo.Mvc.Rendering.KendoHtmlGenerator': Could not load type 'Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache' 
from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

 

 

Mehmet
Top achievements
Rank 2
 answered on 09 Jul 2020
5 answers
268 views
How do we include antiForgeryTokens to the submit action?
Ivan Danchev
Telerik team
 answered on 08 Jul 2020
1 answer
321 views
I can see that its possible to use most of the kendo editors for a field, but how do I use a <textarea> and not a textbox?  I'm aware that there's the Editor control, but I want pure text, not HTML, RTF or any other markup.
Dimitar
Telerik team
 answered on 08 Jul 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?