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

Ajax bind - possible to pass parameters to controller?

4 Answers 122 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.
michael miller
Top achievements
Rank 1
michael miller asked on 12 Oct 2011, 06:58 PM
Hi all, I have a MVC grid bound to a controller action and pulling data; it looks great. 

Now the trick: I'd like to pass user input along with the request. In this example, there is a search box on the form, which needs to come up as a parameter. I see in the documentation that you *can* pass parameters to the Select action using ViewData, but that doesn't help me here.

Any suggestions would be much appreciated !




4 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 13 Oct 2011, 07:51 AM
Hello Michael,

You can send additional data by intercepting OnDataBinding client event and modify e.data.

Best wishes,
Nikolay Rusev
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
0
michael miller
Top achievements
Rank 1
answered on 13 Oct 2011, 05:10 PM
Works perfectly... thanks !
0
Simon
Top achievements
Rank 1
answered on 15 Jan 2012, 05:03 PM
Hello Nikolay,

what kind of object is 'e' in your example and, more important, how can I get it in javascript. I'm trying to set the OnDataBinding purely in javascript. The problem is that I'm seperating JavaScript and HTML-Code and the JavaScript is loaded after the html has been loaded. I tried

$j("#Grid").data = {
   parameter1: "value"
}


But this obviously doesnt work..

Any help appreciated.

Best wishes
Simon
0
Nikolay Rusev
Telerik team
answered on 16 Jan 2012, 10:48 AM
Hello Simon,

e is the argument of the event passed to the handler. The link in my previous post contains sample code for the handler.

Greetings,
Nikolay Rusev
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
michael miller
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
michael miller
Top achievements
Rank 1
Simon
Top achievements
Rank 1
Share this question
or