Telerik Forums
UI for ASP.NET Core Forum
1 answer
388 views

I want to use this demo:  https://demos.telerik.com/aspnet-core/multiselect and have a checkbox on left side of the list.
Upon selecting the tag I want to see the count of items selected instead of showing them as chips with names as selected.

I want to use this demo : https://demos.telerik.com/kendo-ui/dropdownlist/index and have a checkbox and show count for no of tags selected as in this demo: Kendo UI Snippet | Kendo UI Dojo (telerik.com).

I see a jquery approach but I want to implement a html tag helper approach in both cases for asp net core
I have attached a image that I have as UI

 
Peter
Telerik team
 answered on 13 Oct 2023
2 answers
90 views

Hi,

I am trying to submit multiple POMaterials through this form. But it doesn't work. I entered a breakpoint to check if data is being passed from the view, but I get null entry for all the Entries in the grid.

 

 

<form asp-action="CreatePO" id="PorequestForm" name="PorequestForm"><div asp-validation-summary="ModelOnly" class="text-danger"></div><fieldset><legend>Materials</legend> @*@Html.LabelFor(category => category.Justification) @Html.EditorFor(category => category.Justification)*@ @( Html.Kendo().Grid(Model.POMaterials) .Name("PoMaterial") .ToolBar(tools => tools.Create().Text("Add PO Materials")) .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom)) .Columns(columns => { columns.Bound(p => p.ItemNumber).ClientTemplate("#= ItemNumber #" + "<input type='hidden' name='POMaterial[#= index(data)#].ItemNumber' value='#= ItemNumber #' />" ); columns.Bound(p => p.Description).ClientTemplate("#= Description #" + "<input type='hidden' name='POMaterial[#= index(data)#].Description' value='#= Description #' />" ); columns.Bound(p => p.Amount).ClientTemplate("#= Amount #" + "<input type='hidden' name='POMaterial[#= index(data)#].Amount' value='#= Amount #'/>" ); columns.Bound(p => p.UnitCost).ClientTemplate("#= UnitCost #" + "<input type='hidden' name='POMaterial[#= index(data)#].UnitCost' value='#= UnitCost #' />" ); columns.Bound(p => p.PomaterialId).Hidden().ClientTemplate("#= PomaterialId #" + "<input type='hidden' name='POMaterial[#= index(data)#].PomaterialId' value='#= PomaterialId #' />" ); columns.Command(command => command.Destroy()).Width(100); }) .DataSource(dataSource => dataSource.Ajax() .Model(model => { model.Id(p => p.PomaterialId); model.Field(p => p.PomaterialId).Editable(false); }) .Batch(true) //.Read(read => read.Action("ReadPoRequest", "Grid")) //.Create(create => create.Action("AddPORequest", "Grid")) .ServerOperation(false) ) ) </fieldset>

 

</form>

public IActionResult CreatePO() { ViewData["WorkflowStatusId"] = new SelectList(_ob.WorkFlowStatuses.ToList(), "WorkFlowStatusId", "Value"); ViewData["ApprovalStatusId"] = new SelectList(_ob.ApprovalStatuses.ToList(), "ApprovalId", "Value"); TempData["poId"] = _ob.Porequests.Max(x => x.Id + 1); return View(new Porequest()); } [HttpPost] //[ValidateAntiForgeryToken] public IActionResult CreatePO(Porequest porequest) { porequest.VendorId = (int)TempData["VenId"];//Insert breakpoint here to check for the values being passed by the view _ob.Add(porequest); _ob.SaveChanges(); return RedirectToAction(nameof(PurchaseOrders));

}

Script it is located here

<script>
    function index(dataItem) {
        var data = $("#PoMaterial").data("kendoGrid").dataSource.data();

        return data.indexOf(dataItem);
    }
</script>


Andi
Top achievements
Rank 1
Iron
Iron
 answered on 13 Oct 2023
1 answer
194 views

I have a grid with a Create button and Search field in the toolbar. I would like to add a count of the number of items in the grid. I am aware that it's possible to add paging to display the count and then disable it with:

PreviousNext(false).Numeric(false)

However, that results in wasted space because there's a row for the pager and count, and another row with the Create button and Search field.

Is it possible to add the item count to the custom toolbar so that everything is in in one row?

Thanks

Mihaela
Telerik team
 answered on 10 Oct 2023
0 answers
80 views
As of R3 2023 release, the font icons are detached from the themes css files. If you are still using font icons, make sure to include a reference to the font icons in your applications. You can read more information about the change in the following blog post: https://www.telerik.com/blogs/future-icons-telerik-kendo-ui-themes. It contains essential information about the change for all products and migration articles to svg icons.
Telerik Admin
Top achievements
Rank 1
Iron
 asked on 06 Oct 2023
1 answer
466 views

Hi

Can we achieve sticky header on the grid with page scroll instead of having a scrollbar within a grid.

If you refer to any example: https://demos.telerik.com/aspnet-core/grid they have one scrollbar for grid n one for page. Can we eliminate grid n display all data rows n have a sticky header as we goes down?

1 answer
1.1K+ views

Is there another (hopefully easier) way to get the packages needed to start working the ASP.NET Core components?  It took a lot of trial and error searching to finally get the Package Source working. 

I had to use the Windows Credential Manager to remove all telerik related credentials and start over with the .msi installer... I was able to go back into VS2022 and add a telerik Package Source.  When prompted, I added the same credentials I use to access my telerik.com account (from which I downloaded the .msi installer, btw).

Finally, I selected an ASP.NET Core Web app project, then Manage Nuget Packages, and was able to browse/find the Telerik.UI.for.AspNet.Core.2023.2.289 package.  Selected that, then clicked install and... it failed with what appears to be related to sub dependencies.

This whole process has been ridiculously complicated.  Is there way to get this working just so we can work through an tutorial or two?

Alexander
Telerik team
 answered on 03 Oct 2023
0 answers
71 views


<div id="divGrid">
                @(Html.Kendo().Grid<dynamic>()
                .Name("gridItem")
                .Columns(columns =>
                {
                    if (Model != null)
                    {
                        foreach (System.Data.DataColumn column in Model.Columns)
                        {
                            columns.Bound(column.ColumnName);
                        }
                    }
                })
                .Pageable()
                .Sortable()
                .Filterable()
                .Groupable()
                .Scrollable()                
                .HtmlAttributes(new { style = "width: 1800px; height: 600px;" })                
                .Events(e => e.DataBound("ModuleItem.OnColumnWidth"))
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Model(model =>
                    {                
                        if (Model != null)
                        {
                            foreach (System.Data.DataColumn column in Model.Columns)
                            {
                                var field = model.Field(column.ColumnName, column.DataType);
                                field.Editable(false);
                            }
                        }
                    })
                    .Read(read => read.Action("Read", "Item"))
                )
                )

            </div>
@section Scripts {
    
        <script src="~/js/item.js" asp-append-version="true"></script>
   

    
 }



var ModuleItem = (function () {

    var init = function () {
        
        

    };

    var setColumnWidth = function () {

        debugger;
        var options = $("#gridItem").data("kendoGrid").getOptions();
        for (i = 0; i < options.columns.length; i++) {
            options.columns[i].width = "100px";
        }
        $("#gridItem").data("kendoGrid").setOptions(options);
    };

    return {
        Init: init,
        OnColumnWidth: setColumnWidth
    };

})();

$(document).ready(function () {

    ModuleItem.Init();    
});

The kendo grid is bound dynamically from a datatable since the columns can be dynamic. 

How to set the with of the columns. I am using the code as described but getting this error for each row. Also if I need to modify column attributes where should it be handled.

Uncaught TypeError: Cannot read properties of null (reading 'sort')
    at init.refresh (kendo.all.js:313050:21)
    at init.trigger (kendo.all.js:313050:21)
    at init._process (kendo.all.js:313050:21)
    at init.success (kendo.all.js:313050:21)
    at success (kendo.all.js:313050:21)
    at n.success (kendo.all.js:313050:21)
    at c (jquery.min.js?v=sC4DguVhnpO_D28VleBggrIrr2VBjHPGn5MoyC7SJ0E:2:34433)
    at Object.fireWith [as resolveWith] (jquery.min.js?v=sC4DguVhnpO_D28VleBggrIrr2VBjHPGn5MoyC7SJ0E:2:35386)
    at l (jquery.min.js?v=sC4DguVhnpO_D28VleBggrIrr2VBjHPGn5MoyC7SJ0E:2:96312)
    at XMLHttpRequest.<anonymous> (jquery.min.js?v=sC4DguVhnpO_D28VleBggrIrr2VBjHPGn5MoyC7SJ0E:2:99172)
AMRUTH
Top achievements
Rank 1
 asked on 02 Oct 2023
1 answer
83 views

I'm using DropDownList in grid as EditorTemplate. If no value is selected I get a message that says "The Id field is required". How to change the message or remove it completely?

Vasko
Telerik team
 answered on 02 Oct 2023
0 answers
68 views
I think heading is enough.
kva
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 29 Sep 2023
1 answer
130 views

Hi All,

We have a table for managing a business process that needs to display an item from the inventory tables. Therefore we need the column showing what Item a record will use to be a ForeignKey column. We have had various problems getting this to work, and our best solution so far is still not functional. The DropDownList just closes as soon as you click into it. It is bound with server filtering.

The column definition:

columns.ForeignKey(p => p.ItemMasterId, ds => ds.Read(r => r.Action("ItemMasters", "MasterMix")), "ItemId", "ItemName", true)
                                    .Title("Item Name").Width(500).EditorTemplateName("ItemMasterDropDownEditor");

The editor template:

@model object

@(Html.Kendo().DropDownListFor(model => model)
        .DataSource(source =>
        {
            source.Read("ItemMasters", "MasterMix").ServerFiltering();
        })
        .Filter(FilterType.Contains)
        .DataValueField("ItemId")
        .DataTextField("ItemName")
)

The server-side call:

public ActionResult ItemMasters(string text)
        {
            var itemMasters = string.IsNullOrEmpty(text) ? db.ItemMasters.OrderBy(o => o.ItemName).Select(p => new ItemMasterVM(p.Id, p.ItemName)).ToList()
                : db.ItemMasters.OrderBy(o => o.ItemName).Where(e => e.ItemName.ToLower().Contains(text.ToLower())).Select(p => new ItemMasterVM(p.Id, p.ItemName)).ToList();
            return Json(itemMasters);
        }

 

The list is working correctly showing all we need. We just can't get the dropdown to stay open and have the cursor in the filter search text box.

Thanks in advance... Bob Graham

 

Anton Mironov
Telerik team
 answered on 27 Sep 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?