Home > DeveloperSection > Forums > How use selectedIndexChanged from dropdownlist in clientSide and ServerSide
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    August-28-2014 1:40 AM

 ASP.Net
Ratings:


 1 Reply(s)
 752  View(s)
Rate this:

In clientside i want call javascript funcition!

 

<script type="text/javascript">

function changeCursor() {

    document.body.style.cursor="progress";

}

</script>

 

<asp:DropDownList ID="DropDownSubject" runat="server" DataTextField="Word" AutoPostBack="True" OnSelectedIndexChanged="SelectedChange">

</asp:DropDownList>

SelectedChange is a name of function in clientside!

Thanks for help!



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    August-28-2014 2:23 AM

Hi Ankita, 

In Code behind

<asp:DropDownList ID="DropDownSubject" runat="server" DataTextField="Word" AutoPostBack="True" OnSelectedIndexChanged="SelectedChange" onchange="YourChangeFun(this);">

</asp:DropDownList>

In javascript

<script type="text/javascript">

      function YourChangeFun(ddl)

      {

         alert(ddl.selectedIndex);

      }

</script>


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

Follow MindStick