Click here to Skip to main content
14,826,921 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
 @Html.DropDownList("StateDropDown", new SelectList(Model, "VentureLocationID", "VentureLocationName"),"Projects", new { @id = "StateDropDown" })

<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $("#StateDropDown").change(function () {
            $.ajax({
                type: 'GET',
                url: @Url.Action("Index","Venture")+ this.value,
                     });
        });
    });
</script>

i am getting data in to dropdown list.based on the datavalue field i want to redirect to the corresponding action in a controller.but event is not fairing.can any one suggest please
Posted

try the following code
$('#StateDropDown').bind('change', function ()
{
$.ajax({
url: '@Url.Action("Action","controller")',
data: { stateID:$('#StateDropDown').val()},
dataType: "json",
type: "Get",
success: function (response)
{}
});
});
   
v2
Comments
laxmi smiley 11-Mar-14 9:47am
   
control is moving to the corresponding action but datavalue field is empty.any suggestion please
data: { stateID:$('#StateDropDown').val()} the value #StateDropDown is new { @id = "StateDropDown" }
public actionresult(string stateID}
{
}
var value = $("#StateDropDown option:selected").val();
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900