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

Is it possible to change the k-i-filter on the grid column to k-i-filter-clear when the filter is on active state?


Stoyan
Telerik team
 answered on 28 Jun 2021
1 answer
2.3K+ views

 <div class="k-rtl">

    @(Html.Kendo().Grid<BookStore1.Models.Author>
                    ()
                    .Name("ParameterGrid")
                    .Columns(column =>
                    {
                        column.Bound(c => c.Id).Hidden();
                        column.Bound(c => c.FullName).Title("Arabic Desc");

                        column.Command(com =>
                        {
                            com.Edit().UpdateText("حفظ").Text("تعديل").CancelText("إلغاء").HtmlAttributes(new { type = "button", @class = "btn-basic ", });
                            com.Destroy().Text("حذف").HtmlAttributes(new { type = "button", @class = "btn-basic ", });
                        }).Width(200);

                    }).HtmlAttributes(new { style = "height:500px" })
            //.ToolBar(toolbar =>
            //{
            //    toolbar.ClientTemplateId("<a class='k-button' href='" + Url("Create", "Authors1") + "/test' " + ">Add product</a>" + "<a class='k-button' href='" + Url.Action("Index", "Authors1") + "/test' " + ">Other button</a>");
            //})
            .ToolBar(toolbar => toolbar.Create().Text("إضافة جديدة").HtmlAttributes(new { type = "button", @class = "btn-basic ", }))
            .Editable(editable => editable.Mode(GridEditMode.PopUp))
            .Events(e => e.Edit("NewRecord"))
            .Scrollable()
            .Sortable()
            .Selectable()
            .Filterable(f => f.Extra(false)
                                .Operators(opertor => opertor
                                .ForString(str => str.Clear()
                                .Contains("يحتوي على"))))
            .Pageable
            (p => p
            .ButtonCount(10)
            .Refresh(true)
            )
            .DataSource
            (dataSourec => dataSourec
            .Ajax()
            .Events(e => e.Error("Error_Handler"))
            .Model(m => m.Id(i => i.Id))
            .Read(read => read.Action("Read", "Authors1"))
            .Create(create => create.Action("Create", "Authors1"))
  )
    )

      @(Html.Kendo()
            .Window()
            .Name("Details")
            .Title("test")
            .Visible(false)
            .Modal(true)
            .Draggable(true)
            .Width(300)
            )

</div>

<div id="test"></div>

 

<script>

$('input[name="FullName"]').keypress(function () {

        var input = $(this).val();
        $.ajax({
            type:"post",
            url: "@Url.Action("Search","Authors")",
            datatype: "html",
            data: { input: input },
            success: function (data) {
                $("#test").html(data);//// this is work fine but I want to return partial view in kendo window here 

                here I need to return partial view in kendo window here         
            },
            error: function () {

            }


        })
    });


</script>

       
Aleksandar
Telerik team
 updated answer on 28 Jun 2021
1 answer
358 views

In picture 1: pic 1: ActualStartDate & ActualFinishDate allow null-able value.

In Picture 2: because their types allow nullable so the values of Actual Start Date & Actual Finish Date must be empty. Because I am using .DateInput(true) in the controls so now they have value 'day month year'. 


Currently, I am getting an error model state is invalid, Could you help me how to clear 'day month year' when using .DateInput(true)
Mihaela
Telerik team
 answered on 25 Jun 2021
1 answer
131 views

I am reviewing some code and I am trying to find documentation for the UploadBlobs method with no luck.

Could someone provide a link?

Mihaela
Telerik team
 answered on 25 Jun 2021
1 answer
202 views

Hello,

How do you generate a unique name for a control that is part of a template? I have a DropDownList in my template for a TaskBoard but only the first instance works since the name of each is the same I assume. The browser warns me too that that is the case. Appreciate any help.

 

-Scott

Tsvetomir
Telerik team
 answered on 25 Jun 2021
1 answer
119 views
<p>When I first show results I have the grid height set to screen height. The grid is scrollable. What I want to happen is that when I reduce the height from say 750px to 200px is for that row to show in the top of the new small view port. When selecting a row all the information displays below the grid regarding that row. Further info, say I pick row 18 and when I make the k-grid-content class's height shorter can I then make row 18 show at the top of that.</p><p>Thanks, John <br /></p>
Aleksandar
Telerik team
 answered on 24 Jun 2021
1 answer
253 views
How do you get the drop down list on the multiselect using the tag helper?  In the examples on this page the drop down list is only appearing using the html helper.
Tsvetomir
Telerik team
 answered on 24 Jun 2021
1 answer
1.3K+ views

I have an enum in my model for Currency, like so

 


public class Project
    {
        public Currencies Money { get; set; }
       
        public int CurrencyId { get; set; }
        public string CurrencyName { get; set; }
        public string ContractPerson { get; set; }

        public enum Currencies
        {
            [Display(Name = "Euro")]
            Euro = 1,
            [Display(Name = "USD")]
            USD = 2,
            [Display(Name = "MKD")]
            MKD = 3
        }
}

and I am trying to display the text instead of the id in my Kendo grid but I am not sure how to proceed. I can show the currencyId but not sure how to show the actual text. This is my grid

 


<div class="clearfix">
        @(Html.Kendo().Grid<Projects.Domain.Project>()
                    .Name("projectsGrid")
                    .ToolBar(toolbar => toolbar.Create())
                    .ToolBar(e =>
                    {
                        e.Custom().Text("Export to excel").HtmlAttributes(new { id = "excelButton" });
                    })
                    .Editable(editable => editable.Mode(GridEditMode.PopUp))
                    .Pageable(pageable => pageable.Input(true).Numeric(false))
                    .PersistSelection()
                    .Scrollable()
                    .Sortable()
                    .Events(ev => ev.Change("onChange"))
                    .Filterable()
                    .ColumnMenu()
                    .Groupable(false)
                    .Columns(columns =>
                    {
                        columns.Select().Width(50);
                        columns.Bound(c => c.CurrencyId).Title("currency").Width("200px");
                        columns.Bound(c => c.ContractPerson).Title("ContractPerson").Width("200px");
                        columns.Bound(c => c.UrlWiki).Title("UrlWiki").Width("200px");
                        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
                    })
                    .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Events(events => events.Error("error_handler"))
                    .Model(model => model.Id(p => p.Id))
                    .Create(update => update.Action("EditingPopup_Create", "Projects"))
                    .Read(read => read.Action("GetProjects", "Projects"))
                    .Update(update => update.Action("EditingPopup_Update", "Projects"))
                    .Destroy(update => update.Action("EditingPopup_Destroy", "Projects"))
                    )
        )
    </div>

Any pointers on how to proceed?

Stoyan
Telerik team
 updated answer on 23 Jun 2021
1 answer
230 views

I have a view for Create as well as Edit. My question is can I use those views to show when I click the Create New Popup dialog? 

 

So if I click the Add new record, it'll show the built in grid popup dialog window. Instead of the built in dialog, can I set the grid to show my own Create view? The Create.cshtml? The same goes for the Edit view, when I click the Edit button, can I set it to use the Edit.cshtml instead of the built it edit popup dialog?

Mihaela
Telerik team
 answered on 23 Jun 2021
3 answers
2.1K+ views

Good Day,

I am actually looking to find a way to save only filter, sort and current paging options when a user interract with the grid. I have seen this demo https://demos.telerik.com/aspnet-core/grid/persist-state, but I would like it to be automatically instead of having external button to do the action.

I have tried also binding on the databound event using a flag like so, but it only works the first time. My function is a little bit generic, because I would like to automatically do it for every grid in the application without having to configure anything.

    let stateChanged = false;
    $('.k-grid').data('kendoGrid').bind('filter', function (e) {
        stateChanged = true;
    });

    $('.k-grid').data('kendoGrid').bind('sort', function (e) {
        stateChanged = true;
    });

    $('.k-grid').data('kendoGrid').bind('dataBound', function (e) {
        if (stateChanged) {
            const grid = e.sender;
            const storageKey = generateStorageKey(grid);
            const options = grid.getOptions();
            saveGridState(options, storageKey);
            stateChanged = false;
        }
    });

Is there any other way to actually  save the state of the grid immediately after the user interract with the grid?

Thank you :)

Mihaela
Telerik team
 answered on 23 Jun 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?