---
title: "How to call javascript function on the change of dropdownlist in ASP.Net MVC?"  
description: "How to call javascript function on the change of dropdownlist in ASP.Net MVC?"  
author: "Chris Anderson"  
published: 2011-10-11  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/1289/how-to-call-javascript-function-on-the-change-of-dropdownlist-in-asp-dot-net-mvc  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 1 minute  

---

# How to call javascript function on the change of dropdownlist in ASP.Net MVC?

**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()" })%>

## Answers

### Answer by Chris Anderson

**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()" })%>


---

Original Source: https://www.mindstick.com/interview/1289/how-to-call-javascript-function-on-the-change-of-dropdownlist-in-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
