This is a migrated thread and some comments may be shown as answers.

Customising the Grid toolbar

1 Answer 494 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 18 Mar 2020, 02:17 PM

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.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 23 Mar 2020, 10:00 AM

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.
Tags
Grid
Asked by
Simon
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or