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

[Solved] Passing value of combobox in toolbar

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
john
Top achievements
Rank 1
john asked on 23 May 2012, 04:49 AM
Hello,

I have viewed the example of the custom toolbar template.  As shown, the combobox filters the grid: 
http://demos.telerik.com/aspnet-mvc/grid/customtoolbar 

In my scenario, I have the exact same UI but with the addition of the update command button (this is using ajax).  My problem is that when I update a record (a row in the grid by clicking the update button and saving the result), the view returned (following the update) does not default to the original filter specified by the combobox.

I am struggling with how to pass the value of the combobox to the controller so that the view returned is able to return the original filter.  I have googled the heck out of this, but posted here to see what the best approach is.  

Thanks for listening,

John

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 23 May 2012, 07:18 AM
Hello John,

You should use the OnSave event of the Grid and append your value to the other form data like so:
function onSave(e){
    e.values.myComboFilterValue = $('#MyCombo').data('tComboBox').value();
}

On the server side use the same name (myComboFilterValue) to name the argument in the action method.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Grid
Asked by
john
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or