locked
Onchange and SelectedIndexChanged RRS feed

  • Question

  • why Onchange property and SelectedIndexChanged of a dropdown list is not working at a time?
    Tuesday, August 29, 2017 6:19 AM

All replies

  • Hi,

    Do you have a piece of code to help you ?

    Cédric

    Tuesday, August 29, 2017 7:16 AM
  • Hello Nidhi1214,

    The following is my testing result. 

    <form id="form1" runat="server">
            <div class="hasJS">
        <asp:DropDownList class="custom" ID="myid" runat="server" OnSelectedIndexChanged="myid_SelectedIndexChanged" AutoPostBack="True" onChange="myChange();">
        <asp:ListItem>Hello</asp:ListItem>
        <asp:ListItem>Hello1</asp:ListItem>
        <asp:ListItem>Hello3</asp:ListItem>
        </asp:DropDownList>;
            </div>
    
     <script type="text/javascript">
       function myChange() {
           alert("Hai");
       }
        </script>
    

    It seem that everything works well. when the dropdownlist index has changed , The  onchange property will be called first , then the OnSelectedIndexChanged event is triggered.  these methods have the order of execution. And If I misunderstand what you want , you could provide more information about your issues.

    I think the follow forum is a better place that you should post.

    https://forums.asp.net/

    Best regards,

    feih_7


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 29, 2017 9:45 AM
  • Hi Nighi1214,

    Could you please show use the code where you are getting issue. This will help us to give you appropriate solution. Also could you tell what type of project you are doing WinForm, WPF, ASP.Net?

    If your issue is related to web then ask in ASP.Net forum for getting quick response.

    https://forums.asp.net/


    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Tuesday, August 29, 2017 10:22 AM