top button
Flag Notify
Site Registration

Write a program to call the js function when the change is being made in the Dropdown list made in ASP.NET MVC?

0 votes
311 views
Write a program to call the js function when the change is being made in the Dropdown list made in ASP.NET MVC?
posted Sep 8, 2016 by Jayshree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

To call the function of the js (JavaScript) in the dropdown list in ASP.NET MVC the function has to be written like:

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

The function need to be called using the code nuggets or if the Razor view engine the the js has to be integrated as:

 <%:Html.DropDownListFor(x => x.SelectProduct, new SelectList(Model.Products, "Value", "Text"), "Select product", new { id = "dpDown", onchange="selectedIndexChanged()" })%>
answer Sep 9, 2016 by Shivaranjini
...