Saturday, 31 August 2013

ChildAction triggered on dropdown change in partial view

ChildAction triggered on dropdown change in partial view

I want to trigger a ChildAction on the Home Controller on the onchange
event of a dropdown. The dropdown is located at the _Layout.cshtml.
Is it possible to do it on javascript?
Here is my code as of the moment.
$('#langDropdown').change(function() {
var lang = $(this).val();
alert(lang);
});
And here is my dropdown:
@Html.DropDownList("Language", ViewData["Languages"] as SelectList, new {
id = language })
It not inside of any form. Any suggestion how can I do it. Thanks!
Note: I just use alert for testing purposes.

No comments:

Post a Comment