1
votes

I have a C#.Net MVC3 web app. There is and Edit View for my Proposal Model. On the Edit View is a drop down list with a list of Proposals. The requirement is that, when a user changes the selectin in the Drop Down list, the selected proposal needs be loaded by the Proposal Controller. I am able to get the Edit View submitted, but don't know how to grab the value in the DropDownList to find what Proposal was selected. I'm sure this is very do-able. Ideas?

1

1 Answers

2
votes

You could put the dropdownlist inside a form and then when the selection changes submit the form. This way the selected value will automatically be sent to the controller action. Or if you are manually doing some AJAX request when the selection changes you could send the selected value along with the request:

$('#id_of_your_ddl').change(function() {
    var selectedProposal = $(this).val();
    $('#resultDiv').load('@Url.Action("Index", "Proposal")', { id: selectedProposal });
});