0

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?

Community
  • 1
  • 1
ilay zeidman
  • 2,654
  • 5
  • 23
  • 45

1 Answers1

1

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.

Brad Christie
  • 100,477
  • 16
  • 156
  • 200