Home > DeveloperSection > Interviews > How to call javascript function on the change of dropdownlist in ASP.Net MVC?

Posted on    October-11-2011 2:36 AM

 ASP.NET MVC ASP.NET MVC 
Ratings:
 1 Answer(s)
  5518  View(s)
Rate this:

Chris Anderson
Chris Anderson

Total Post:197

Points:985
Posted on    October-11-2011 12:00 AM

Create a java-script function:

<script type="text/javascript">
            function selectedIndexChanged() {
            }
</script>

Call the function:

<%:Html.DropDownListFor(x => x.SelectedProduct, new SelectList(Model.Products, "Value", "Text"), "Please Select a product", new { id = "dropDown1", onchange="selectedIndexChanged()" })%> 

Don't want to miss updates? Please click the below button!

Follow MindStick