ASP.Net MVC Question:

Download Job Interview Questions and Answers PDF

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

ASP Dot Net MVC Interview Question
ASP Dot Net MVC Interview Question

Answer:

- 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()" })%>

Download ASP Dot Net MVC Interview Questions And Answers PDF

Previous QuestionNext Question
Explain ASP.NET MVC Request Life Cycle?Explain the main function of URL routing system in ASP.NET MVC?