SelectedIndexChanged not event firing on DropDownList when changed programatically

Discussion in 'ASP .Net Web Controls' started by Rob, Jul 31, 2007.

  1. Rob

    Rob Guest

    Hi,

    We have a custom control which contains a number of dropdownlists. Within
    the custom control class we have a handler for the SelectedIndexChanged
    event. This event fires when the user selects an item from the dropdownlist,
    but it's not firing when we change the selected value in the custom
    control's properties. It changes the selected value successfully, but no
    event is fired.

    In addition to this, changing the selection in one dropdownlist causes the
    available selections in the other dropdownlist to change. This is working
    successfully, however, when I attempt to access the new list, I'm unable to
    because it's still holding the old values.

    Can anybody tell me what I might be doing wrong. Unfortunately I can't
    provide any code snippets because I'm writing this post from home

    Thanks
     
    Rob, Jul 31, 2007
    #1
    1. Advertising

  2. Rob

    Teemu Keiski Guest

    Hi,

    that's by design if I understand your description correctly. ASP.NEt throws
    events only based on user interaction, e.g when user has changed the
    selection on the browser e.g at client. But if you change it
    programmatically (in server-side code), no event is fired.

    It's explained in

    ASP.NET Web Server Control Event Model
    http://msdn2.microsoft.com/en-us/library/y3bwdsh3.aspx


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    "Rob" <> wrote in message
    news:...
    > Hi,
    >
    > We have a custom control which contains a number of dropdownlists. Within
    > the custom control class we have a handler for the SelectedIndexChanged
    > event. This event fires when the user selects an item from the
    > dropdownlist, but it's not firing when we change the selected value in the
    > custom control's properties. It changes the selected value successfully,
    > but no event is fired.
    >
    > In addition to this, changing the selection in one dropdownlist causes the
    > available selections in the other dropdownlist to change. This is working
    > successfully, however, when I attempt to access the new list, I'm unable
    > to because it's still holding the old values.
    >
    > Can anybody tell me what I might be doing wrong. Unfortunately I can't
    > provide any code snippets because I'm writing this post from home
    >
    > Thanks
    >
    >
     
    Teemu Keiski, Aug 1, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DesignerX
    Replies:
    2
    Views:
    3,836
    Bob Carsto
    Nov 14, 2003
  2. Paul Lacey
    Replies:
    2
    Views:
    2,707
    =?Utf-8?B?TmlrYW5kZXIgJiBNYXJncmlldCBCcnVnZ2VtYW4=
    Feb 17, 2005
  3. Lew Barnesson
    Replies:
    3
    Views:
    809
    Lew Barnesson
    Dec 4, 2004
  4. =?Utf-8?B?Q3VybHlGcm8=?=

    dropdownlist selectedIndexChanged event not firing

    =?Utf-8?B?Q3VybHlGcm8=?=, Aug 14, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,629
    =?Utf-8?B?Q3VybHlGcm8=?=
    Aug 14, 2005
  5. BentleyInc

    DropDownList.SelectedIndexChanged event not firing

    BentleyInc, Dec 10, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    1,259
    Steven Cheng[MSFT]
    Dec 14, 2004
Loading...

Share This Page