Telerik Forums
UI for ASP.NET Core Forum
7 answers
168 views

I have a method that validates if the registry is duplicated. How can I use this validation in the edit / insert popup?

 

 

 

@(Html.Kendo().Grid<Site.Models.BreedViewModel>()                                                             .Name("grid")                                                             .Columns(columns =>                                                             {                                                                 columns.Bound(b => b.BreedId).Title("ID")                                                                     .Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(true))).Width(120);                                                                 columns.Bound(b => b.BreedCode).Width(140).Title("Code");                                                                 columns.Bound(b => b.BreedName).Width(220).Title("Name");                                                                 columns.Bound(b => b.Type)                                                                     .ClientTemplate("# if( Type === 1) { # <span>Beef</span> # } else { # <span>Dairy</span> # } #").Width(140);                                                                 columns.Bound(b => b.Active)                                                                     .ClientTemplate("# if( Active ) { # <span class='k-icon k-i-check-outline'></span> # } else { # <span class='k-icon k-i-close-outline'></span> # } #").Width(145);                                                                 columns.Bound(b => b.Description).Width(220).Title("Description");                                                                 columns.Command(command =>                                                                 {                                                                     command.Edit().CancelText("Cancel").UpdateText("Save").Text(" ");                                                                     command.Custom("wnDelete").Click("wnDelete").Text(" ").IconClass("k-icon k-i-delete");                                                                     command.Custom("ViewDetails").Click("ViewDetails").Text(" ").IconClass("k-icon k-i-zoom-in");                                                                 }).Width(100);                                                             })                                                             .ToolBar(t => { t.Create().Text("Add"); t.Excel(); })                                                             .Editable(editable => editable.Mode(GridEditMode.PopUp)                                                                 .DisplayDeleteConfirmation(false)                                                                 .TemplateName("BreedEdit").Window(w => w.Title("Breed")))                                                             .Scrollable(s => s.Height("auto"))                                                             .Pageable(pageable => pageable                                                                 .Refresh(true)                                                                 .PageSizes(true)                                                                 .ButtonCount(5))                                                             .Events(events => events                                                                 //.Change("onChange")                                                                 .DataBound("onDataBound")                                                                                                                                  //.Save("onSave")                                                             //.DataBinding("onDataBinding")                                                             )                                                             .Sortable()                                                             .Scrollable()                                                             .Excel(excel => excel.FileName("export.xlsx").AllPages())                                                             .Filterable()                                                             .DataSource(dataSource => dataSource                                                                 .Ajax()                                                                 .PageSize(20)                                                                 .Events(e =>{                                                                     e.Error("onGridError");                                                                                                                                          //e.RequestEnd("wasSaveSuccessful");                                                                 })                                                             .Model(model => model.Id(p => p.BreedId))                                                             .Create(update => update.Action("EditingPopup_Create", "Breed"))                                                             .Read(read => read.Action("EditingPopup_Read", "Breed"))                                                             .Update(update => update.Action("EditingPopup_Update", "Breed"))                                                             .Destroy(update => update.Action("EditingPopup_Destroy", "Breed"))                                                     ) )@(Html.Kendo().Window().Name("Details")                                             .Title("Details")                                             .Visible(false)                                             .Modal(true)                                             .Draggable(true)                                             .Width(500) )@(Html.Kendo().Notification()                     .Name("notification")                                     .Position(p => p.Pinned(true).Top(30).Right(30))                                      )

Georgi
Telerik team
 answered on 30 Aug 2018
1 answer
467 views

Hello, I'm creating simple grid, which is populated with data via controller and it's work just fine.

But the problem is when I'm trying to remove a row with .Destroy() method, which doesn't call method from my controller.

 

                         .DataSource(dataSource => dataSource
                                    .Ajax()
                                    .Read(read => read.Action("Read", "controller")) <-- this works well
                                    .Destroy(destroy => destroy.Action("Read", "controller"))) <-- isn't called at all

 

method in controller

        public ActionResult Delete([DataSourceRequest] DataSourceRequest request, Model model)
        { <-- I've put breakpoint here and it's not get there
            return NotFound();
        }

I have no idea where the problem is.

Stefan
Telerik team
 answered on 30 Aug 2018
3 answers
980 views

Hello.

I have a ListView which contains say 10 items. I add a new item programmatically, I am able to select it, but I am not able to make the Listview to Scroll to it.

I found several examples for Grid scrolling to selection, but none of them works for ListView.

Can you please provide some assistance?

Thanks,

Kyriakos

 

Stefan
Telerik team
 answered on 29 Aug 2018
2 answers
571 views

Hello, 

I'm trying to populate my Grid with Json data, which I gets from my controller. I have set breakpoints and checked that the data is returned correctly but Grid isn't filled somehow.

Controller :

        [Route("/api/list/getAll")]
        [HttpPost]
        public IActionResult GetList()
        {
            var result = _ListService.GetAll();
            if (result == null || result.Count == 0)
                return NotFound();

            return Json(result);
        }

 

Razor :

@(Html.Kendo().Grid<Model>()
    .Name("grid")
    .Columns(columns => {
        columns.Bound(c => c.Name).Width(140);
    })
     .Scrollable()
     .Sortable()
     .Pageable(pageable => pageable
                    .Refresh(true)
                    .PageSizes(true)
                    .ButtonCount(5))
     .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("GetList", "controller")))
    )

 

Model has much more fields but I just put only Name for test purposes. But this isn't filled anyway.

I have no idea what I'm doing wrong there is no errors, page just loading and Grid isn't filled.

Konstantin Dikov
Telerik team
 answered on 27 Aug 2018
1 answer
687 views

     I am trying to make a very simple functionality but i cant seem to figure it out.

 

i want to be able to pick a category and a dependent subcategory, how can i achieve this in an inline grid edit? 

Georgi
Telerik team
 answered on 24 Aug 2018
1 answer
74 views

Hello I'm using Grid and my qiestuon is : Is there any way to remove video-wrapper from DOM ?

 

Greetings

Adrian
Top achievements
Rank 1
 answered on 24 Aug 2018
1 answer
88 views

Hey there,

I am new to learn Telerik. My internship is probably going to give me the task to build charts for their apps.

I've been looking around in VS to put those demo's in. But it is still unclear for me where to put it in.

So my question is, can someone help me with this? If you can reply that would be awesome! (or add me on discord: bjeako#1286)

Pavlina
Telerik team
 answered on 24 Aug 2018
5 answers
184 views

Hi, I'm having a problem on rendering my listbox every time I call my modal.

 

Please see the attached file.

here's my code:

<div class="modal fade" id="assign-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="max-width:790px!important;">
        <div class="modal-content">
            <div class="modal-header" style="display:block">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="myModalLabel">t</h4>
            </div>
                <div class="modal-body">
                    <input type='text' id='searchBox' class='k-textbox' placeholder='Search' />
                    <div id="example" role="application">
                        <div class="demo-section k-content">
                            <div>
                                <label for="optional" id="agents">FROM</label>
                                <label for="selected">TO</label>
                                <br />
                                <select id="unoptional"></select>
                                <select id="unselected"></select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button id="SaveEdit" type="button" data-save class="btn btn-primary">Assign</button>
                    <button type="button" class="btn btn-default" data-cancel>Cancel</button>
                </div>
        </div>
    </div>
</div>

 

$("#optional").kendoListBox({
                    connectWith: "selected",
                    dataTextField: "FullName",
                    dataValueField: "FullName",
                    selectable: "multiple",
                    toolbar: {
                        tools: ["transferTo", "transferFrom", "transferAllTo", "transferAllFrom"]
                    },
                    dataSource: {
                        serverPaging: true,
                        transport: {
                            read: {
                                url: myUrl,
                                dataType: "json"
                            },
                            schema: {
                                model: {
                                    fields: {
                                        FullName: { type: "string" },
                                        Id: { type: "string" }
                                    }
                                }
                            }
                        }
                    }
            });
            $("#selected").kendoListBox({
                dataTextField: "FullName",
                dataValueField: "FullName",
                selectable: "multiple",
            });

 

Konstantin Dikov
Telerik team
 answered on 23 Aug 2018
6 answers
235 views

Hi,

I have a grid inside a partial view that is bound to a local data (parent viewmodel is passed to the partial view).

The grid displays correctly the datas but when i try to edit a cell, i have this error: 'TypeError: Cannot read property 'Label' of undefined'.
Is there a way to solve this error?

Thanks;

Boyan Dimitrov
Telerik team
 answered on 22 Aug 2018
5 answers
264 views

I am using the 2018.1.221 Kendo UI for .Net Core.  It is a ASP MVC Core app using .net core 2.

This is a grid with Ajax source - the part having issues is here:

            .DataSource(dataSource => dataSource
                .Ajax()
                .Aggregates(a =>
                {
                    a.Add(l => l.Balance).Sum();
                })
                .Read(read => read.Action("Balances_Read", "Balances").Data("getAccountType"))
                .PageSize(250)
            )

This works fine on my development machine (and on a different site hosted on Azure) but on this particular app service I get this exception.  The exception goes away if I remove the aggregates code.  Here is the stack trace upstream from my call:

 

System.Exception: Unable to build typeDynamicClass3
   at Kendo.Mvc.Infrastructure.Implementation.ClassFactory.EmitType(String typeName, CSharpCompilation compilation)
   at Kendo.Mvc.Infrastructure.Implementation.ClassFactory.GetDynamicClass(IEnumerable`1 properties)
   at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionNewExpression(IEnumerable`1 propertyValuesExpressions)
   at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionInitExpression()
   at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateAggregateFunctionsProjectionMemberBinding()
   at Kendo.Mvc.Infrastructure.Implementation.Expressions.QueryableAggregatesExpressionBuilder.<CreateMemberBindings>d__3.MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Dynamic.Utils.CollectionExtensions.ToReadOnly[T](IEnumerable`1 enumerable)
   at System.Linq.Expressions.Expression.MemberInit(NewExpression newExpression, IEnumerable`1 bindings)
   at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateSelectBodyExpression()
   at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilder.CreateSelectExpression()
   at Kendo.Mvc.Infrastructure.Implementation.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
   at Kendo.Mvc.Extensions.QueryableExtensions.Aggregate(IQueryable source, IEnumerable`1 aggregateFunctions)
   at Kendo.Mvc.Extensions.QueryableExtensions.CreateDataSourceResult[TModel,TResult](IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState, Func`2 selector)
   at Bryt.Client.Web.Controllers.BalancesController.Balances_Read(DataSourceRequest request, Int32 accountType) in C:\DataDrive\Working\Bryt\Bryt.Client.Web\Controllers\BalancesController.cs:line 65

 

Again, oddly, this is isolated to running on Azure.

Thanks,

Brian

 

 

 

Boyan Dimitrov
Telerik team
 answered on 20 Aug 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?