How use selectedIndexChanged from dropdownlist in clientSide and ServerSide

Total Post:183

Points:1285
 1361  View(s)
Ratings:
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!

  1. Post:378

    Points:2694
    Re: How use selectedIndexChanged from dropdownlist in clientSide and ServerSide

    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>

      Modified On Apr-05-2018 04:38:35 AM

Answer