Reputation: 2814
I am using devExpress controlls and I have code like this:
settings.ClientSideEvents.RowDblClick = "myJavascriptFunction";
and that mean that when I double click on control it invoke javascript function myJavascriptFunction. I have controller like this:
public class MyController : Controller
{
//
// GET: /My/
public ActionResult Index(string a,string b)
{
return View();
}
}
I want to call that controller method from my javascript.
I read Calling ASP.NET MVC Action Methods from JavaScript
and How to call a Controller method from javascript in MVC3? and more...
but all suggest ajax call and I want to render the whole page to my controller... someone know how to achieve this?
Upvotes: 0
Views: 691
Reputation: 101614
Assuming you mean to just redirect them (no AJAX):
function myJavascriptFunction(){
var a = 'foo', // to parameters of Index
b = 'bar';
window.location = '/My/Index'
+ '?a=' + encodeURIComponent(a)
+ '&b=' + encodeURIComponent(b);
}
Otherwise " I want to render the whole page to my controller. " is a little too vague. Please revise the question and be more specific and I'll adjust my answer.
Upvotes: 1