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

Grid Toolbar

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 12 Jul 2013, 10:01 PM
I have a grid and I added a custom button, I want that button to call a function in my controller and pass the selected value in my dropdownlist. I can get it to call the controller correctly but I can't get the additional data I need to be sent as well.
.ToolBar(commands => commands.Custom().HtmlAttributes(new { id = "SendEmailStatements" })
    .HtmlAttributes(new { @CLASS = "sendBtn" })
    .Text("Send")
    .Action("SendBuyerEmailStatements", "Home", new { DayendCycle = SelectedDayendCycle})
)
SelectedDayendCycle is a javascript function that will return the selected item from the dropdownlist but it isn't recognized.
I was hoping I could do the same thing I do in the grid.
.Read(read => read.Action("BuyerEmailStatementsGrid_Read", "Home").Data("SelectedDayendCycle")

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 15 Jul 2013, 11:03 AM
Hi John,

I am afraid the described behavior cannot be achieved with the provided syntax, because you can't pass a Javascript function reference in the server-side Action() fluent method.

What you can do is attach a click (mousedown) handler to the custom toolbar button client-side, retrieve the necessary data and then call the controller's action method with Javascript POST/GET.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or