locked
Dropdownlist is not firing the event: RRS feed

  • Question

  • Hi,

    I'm having the following code in aspx page:

     <asp:DropDownList ID="ddl" runat="server" AutoPostBack="true" OnSelectedIndexChanged="PageSize_Changed">
                            <asp:ListItem Text="Old" Value="Old" />
                            <asp:ListItem Text="New" Value="New" />                        
                        </asp:DropDownList>     

    In the UI, when I change for the first time, from old to new and new to old, the event PageSize_Changed is getting fired. But later, even after changing the values in dropdown, the event is not getting triggered. Could you please let me know what could be the reason?

    Thanks,

    Santosh

    Thursday, August 21, 2014 8:49 AM

Answers

  • How do you know that the event is not firing?

    Maybe the code behind isn't doing anything because you mis-wrote the code.

    Put a breakpoint at the beginning of the event and see if the code stops there.

     

    Noam B.


    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...

    • Proposed as answer by Noam B Tuesday, August 26, 2014 9:51 AM
    • Marked as answer by Just Karl Thursday, September 4, 2014 10:31 PM
    Thursday, August 21, 2014 10:22 AM
  • Please post ASP.NET questions in the ASP.NET forums (http://forums.asp.net).
    • Marked as answer by Just Karl Thursday, September 4, 2014 10:31 PM
    Thursday, August 21, 2014 2:18 PM

All replies

  • That mark up works for me.

    Something else is broke.

    Copy that out your project into a new web project default.aspx.

    Add in the code behind event.

    Put a Debug.Writeline in there.

    Spin it up.

    It works, doesn't it?

    Works every time for me.

    .

    Maybe you have some other code messes with the selected index.

    Or maybe your event code isn't working as expected and you just think it isn't firing because of that.

    .

    Please post further asp.net questions in the asp.net forum.

    There's a link in a sticky thread up there at the top of the c# forum


    Hope that helps
    Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


    • Edited by Andy ONeill Thursday, August 21, 2014 10:29 AM
    Thursday, August 21, 2014 9:35 AM
  • How do you know that the event is not firing?

    Maybe the code behind isn't doing anything because you mis-wrote the code.

    Put a breakpoint at the beginning of the event and see if the code stops there.

     

    Noam B.


    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...

    • Proposed as answer by Noam B Tuesday, August 26, 2014 9:51 AM
    • Marked as answer by Just Karl Thursday, September 4, 2014 10:31 PM
    Thursday, August 21, 2014 10:22 AM
  • Please post ASP.NET questions in the ASP.NET forums (http://forums.asp.net).
    • Marked as answer by Just Karl Thursday, September 4, 2014 10:31 PM
    Thursday, August 21, 2014 2:18 PM