Customising the Grid toolbar

2 posts, 0 answers
  1. Simon
    Simon avatar
    9 posts
    Member since:
    Nov 2019

    Posted 18 Mar 2020 Link to this post

    I have seen a number of Threads on this but none that fully answers what I am trying to achieve. I am after the following :

    ToolBar(toolbar =>
                                        {
                                            toolbar.Create().Text("New Order");
                                            toolbar.Custom()
                                                    . call an action method i.e "<a class='k-button' href='" + Url.Action("Submit", "myController")+"'"+">Submit</a>")
                                                    .Text("Submit").IconClass("k-icon k-i-cancel");

                                        })

     

    The answer on a previous tread :   toolbar.ClientTemplate("<a class='k-button' href='" + Url.Action("Submit", "myController")+"'"+">Submit</a>");

    Does not tell me how I can add the toolbar.Create().Text("New Order"); to the same template.

    I also want to pass to the submit action the current Datasource request information i.e filtering etc so that I can refresh the grid on finish.

     

     

     

     

  2. Nikolay
    Admin
    Nikolay  avatar
    301 posts

    Posted 23 Mar 2020 Link to this post

    Hello Simon,

    The Create command could be added to the Toolbar template as demonstrated below:

    .ToolBar(toolbar => toolbar.ClientTemplate(
                "<a class='k-button k-button-icontext k-grid-add' href='/myController/Create'><span class='k-icon k-i-add'></span>Add new record</a>" +
                "<a class='k-button' href='/myController/Submit'>Submit</a>")
            )

    Regarding the last question, are you trying to persist the Grid state (filter, paging..)? Can you provide more information on the use-case?

    Regards,
    Nikolay
    Progress Telerik

    Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Back to Top