Telerik Forums
UI for ASP.NET Core Forum
2 answers
241 views
How do I set the default zoom option?  I need it to "Fit to screen" when it loads
Joel
Top achievements
Rank 3
Bronze
Iron
Iron
 answered on 14 Jun 2021
1 answer
588 views

Hi,

Is there a UI functionality that could be called to clear all the filters on the grid? Or if this doesn't exist is there a way to just get the whole grid again?

Thanks,

Ivan

Petar
Telerik team
 answered on 14 Jun 2021
1 answer
774 views

Hi everybody,

I'm using .net Core 3.1 and Kendo for Aspnetcore and I'm very happy so far with it.

But I have a question regarding the usage of Editor Templates in Kendo Grids in combination with an active CSP (inline scripts not allowed).

Using .Deferred() is already working to show my Grid, but I'm facing an issue when I try to use editor templates. Editor templates are not rendered because of a violation of the CSP.

Is there any way to edit lines in a Kendo Grid while inline-scripting is restricted by a CSP?

Thanks!

Beatrice

Aleksandar
Telerik team
 answered on 14 Jun 2021
1 answer
3.3K+ views
Hello - I have trouble getting an inline dropdownlist to display in my grid. I believe I have followed the examples out there, but I must be missing something. Any help would be a appreciated. When I run the app this is what I "undefined" in the cells that use a dropdownlist editor and when I click on the cell to edit a text box opens up instead of a drop down list. 

Here is my setup. (non relevant elements removed).

                            @(Html.Kendo().Grid<ETModel.Areas.Admin.Models.EventTriggerGridItem>()
                            .Name("TriggerItems")
                            .Columns(columns =>
                            {
                                columns.Bound(p => p.TriggerAction).ClientTemplate("#=TriggerAction.TriggerActionName#").Sortable(false).Filterable(false).Width(150);
                                columns.Command(command => command.Custom("Delete").Click("deleteEventTrigger")).Width(95);
                            })
                            .PersistSelection()
                            .Editable(editable => editable.Mode(GridEditMode.InCell))
                            .Selectable()
                            .ClientDetailTemplateId("TriggerDetailTemplate")
                            .Scrollable(s => s.Height("auto"))
                            .Resizable(r => r.Columns(true))
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .Batch(true)
                                .Events(events => events.Error("error_handler").RequestStart("hide_validation"))
                                .Model(model =>
                                {
                                    model.Id(p => p.EventTriggerID);
                                    model.Field(p => p.TriggerAction).DefaultValue(ViewData["DefaultTriggerAction"] as GridLookupItem).Editable(true);

                                })
                                .Read(read => read.Action("EventTriggerGrid_Read", "ETModelManager", new { emodelid = Model.EModelID }))
                                .Update(update => update.Action("EventTriggerGrid_Update", "ETModelManager"))
                                .Destroy(destroy => destroy.Action("EventTriggerGrid_Delete", "ETModelManager"))
                                )
                            )


Model...

    // ETModel Builder Grid Support Classes 

    public class TriggerAction
    {
        public string TriggerActionID { get; set; }
        [UIHint("TriggerAction")]
        public string TriggerActionName { get; set; }

    }


    public class EventModelView
    {
        public List<TriggerAction> TriggerActionList { get; set; }

        public EventModelView()
        {

            
            TriggerActionList = new ModelSelectList().GridSelectList("[etm].usp_EventModelDB_GetTriggerActionList").Select(x => new TriggerAction
            {
                TriggerActionID = x.ID,
                TriggerActionName = x.Name,
            }).ToList();

        }

    }

Controller... 

            ViewData["TriggerActionList"] = emodelview.TriggerActionList;
            ViewData["DefaultActionList"] = emodelview.TriggerActionList.First();


Editor Template 

@model ETModel.Areas.Admin.Models.EventModelView
@(Html.Kendo().DropDownListFor(m => m)
    .Name("TriggerAction")
    .DataValueField("TriggerActionID")
    .DataTextField("TriggerActionName")
    .BindTo((System.Collections.IEnumerable)ViewData["TriggerActionList"])
    .OptionLabel("Select...")
    .HtmlAttributes(new { @class = "w-100" })
)








Stoyan
Telerik team
 answered on 10 Jun 2021
0 answers
93 views

I have attached the error picture, we can't find the kendo control for the following. I would appreciate if you can advice. 

 

Thanks

Miro
Top achievements
Rank 1
Iron
Iron
 asked on 10 Jun 2021
0 answers
297 views

Hi,

Any example on  Form Conditional Validation ?

Thanks

Xavier
Top achievements
Rank 1
 asked on 09 Jun 2021
1 answer
267 views

I have an asp.net core razor that contains a TreeView control, populated from a List<TreeViewItemModel> .

<form id="EditEmployees">

 <div>

                  Html.Kendo().TreeView()
                        .Name("ActiveEmployees")
                        .TemplateId("treeview")
                        .BindTo((IEnumerable<TreeViewItemModel>)ViewBag.employeeList)
                        .Checkboxes(c => c.CheckChildren(true))
                        .DragAndDrop(false)
                    )

</div>

 

       <br />

        <div class="form-group form-inline row pull-right">
            <div class="col-sm-10 ">
                <button value="Save" style="margin:0 5px;" class="btn btn-navy">Save</button>
            </div>
        </div>

</form>

My issue:
When I submit the form back to the POST Action in the Controller I would like pass the checked items.
For some reason i can't see the items

Aleksandar
Telerik team
 updated answer on 09 Jun 2021
0 answers
315 views

Hi,

Is there any examples where scheduler is automatically scrolled to current date, but for scheduler created in ASP.NET Core?

This is exactly what I need, but I can't make it work in my ASP.NET Core project: https://www.telerik.com/forums/scheduler-timelinemonth-current-day-visible

My rows.length are always 0, so is my contentDiv.length, when I checked it. 

var scheduler = $("#scheduler").getKendoScheduler();
var contentDiv = scheduler.element.find("div.k-scheduler-content");
var rows = contentDiv.find("tr td");

for (var i = 0; i < rows.length; i++) {
            var slot = scheduler.slotByElement(rows[i]);

            var slotTime = kendo.toString(slot.startDate, "d");
            var targetTime = kendo.toString(time, "d");

            if (targetTime === slotTime) {
                contentDiv.scrollLeft($(rows[i]).offset().left + contentDiv.scrollLeft() - contentDiv.position().left);
            }
        };
Stefan
Top achievements
Rank 1
Iron
 asked on 08 Jun 2021
1 answer
570 views

I've had this issue for years with the Telerik grid when trying to use the built in ColumnMenu in the same grid as template columns. I want to make a template column for a custom button. The column and button work fine, however if the template column is not the last column in the grid it causes the ColumnMenu items to all be off by one. ie: you click one of the columns to hide it in the ColumnMenu and it will hide the one above it in the list instead. It's like the column menu doesnt know to account for the template columns.

The only workaround I've found is to place the template column as the last column in the grid or to make a bound column and set its title to a blank and set sorting/paging both false, however this still then leaves a blank entry in the column menu and is not desirable. Am I missing something when using template columns and the ColumnMenu in the same grid?

Code for my template column:

columns.Template("<button type=\"button\" class=\"btn btn-grid\" data-id=\"#=Id#\"><i class=\"fas fa-fw fa-pencil-alt\"></i></button>");

 

Heres is some code of a grid (I chopped a lot of code out of this grid to simplify it and verified this still has the issue), all of my grids across many projects share this issue. This grid is using version 2020.2.617 and the bootstrap theme.

@(Html.Kendo().Grid<TagGridViewModel>().Name("gridTags")
.Columns(columns =>
{
columns.Template("<button type=\"button\" class=\"btn btn-grid\" data-id=\"#=Id#\"><i class=\"fas fa-fw fa-pencil-alt\"></i></button>");
columns.Bound(c => c.TagId).Filterable(f => f.Cell(cell => cell.ShowOperators(false).SuggestionOperator(FilterType.Contains).MinLength(2))).ClientTemplate($"<a class=\"grid-link\" href=\"{Url.Action("Details", "Tags")}/#=Id#\">#:{nameof(TagGridViewModel.TagId)}#</a>");
columns.Bound(c => c.AddDate).Filterable(false);
columns.Bound(c => c.UpdateDate).Title("Updated").Filterable(false).ClientTemplate($"#={nameof(TagGridViewModel.UpdateDateDisplay)}#");
})
.ColumnMenu(true)
.DataSource(dataSource => dataSource.Ajax().PageSize(25)
.ServerOperation(false)
.Read(read => read.Action("DetailsTagsGridRead", "Clients", new { clientId = Model.Location.ClientId, locationId = Model.Location.Id }))
.Events(events => events.Error("gridError"))
)
)
Aleksandar
Telerik team
 updated answer on 08 Jun 2021
1 answer
118 views

Hello

when mixing Text() and TemplateId() for the headers in a LayoutGrid, it is working fine until Text() is used the first time. After that the header uses the content of the previous header.

The complete example (just copy / paste it):

<div class="demo-section list-wrapper">
    <h3 class="title">
        Reorder Items
    </h3>
    <script id="ll" type="text/x-kendo-template">
        <ul>
            <li class="list-left">Item 1</li>
            <li class="list-left">Item 2</li>
            <li class="list-left">Item 3</li>
        </ul>
    </script>

    <script id="lr" type="text/x-kendo-template">
        <ul>
            <li class="list-right">Item a</li>
            <li class="list-right">Item b</li>
            <li class="list-right">Item c</li>
        </ul>
    </script>

    <script id="header-template" type="text/x-kendo-template">
        <strong>List 2</strong>
    </script>

    <script id="header-template-1" type="text/x-kendo-template">
        <strong>Liste 1</strong>
    </script>
</div>


@(Html.Kendo().TileLayout()
    .Name("tilelayout")
    .Columns(4)
    .Containers(c => {
        c.Add().Header(h => h.TemplateId("header-template-1")).BodyTemplateId("ll");
        c.Add().Header(h => h.TemplateId("header-template")).BodyTemplateId("lr");
        c.Add().Header(h => h.Text("Header for List")).BodyTemplateId("ll");
        c.Add().Header(h => h.TemplateId("header-template")).BodyTemplateId("lr");
    })
    .Resizable()
    .Reorderable()
)

 

I would expect for the headers:

- Liste 1

- List 2

- Header for List

- List 2

 

I get this:

The last one is wrong.

Of course, I can use TemplateId() for all of them.

If it is by design, add a note to the documentation, please.

Best regards

Christine

Aleksandar
Telerik team
 answered on 08 Jun 2021
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
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
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?