DropdownList, RadioButtonList Events in UserControls

Discussion in 'ASP .Net Web Controls' started by Tony T, Feb 16, 2005.

  1. Tony T

    Tony T Guest

    Why is it that, in a UserControl, a Button control fires it's Click routine
    fine, without any specail coding, however, a Dropdownlist or RadioButtonList
    do not fire their SelectedIndexChanged without some massaging?

    I've created a UserControl which contains 2 WebControls.TextBoxes, 1
    WebControls.DropdownList, and 2 WebContols.Button and I a cannot seem to get
    the SelectedIndexChanged routine, for the DropdownList, to fire.

    I've set the AutoPostback to TRUE for the DropdownList.

    Rather than posting code and asking for you to correct it, I'm looking for
    an explanation as to why it appears there is a difference between the Button
    and DropdownList controls. So eventhough the SelectedIndexChanged routine
    for a DropdownList control is VERY similar to the Click routine for a Button
    control, and they are both WebControls, why does there appear to be a
    difference in the way these two controls behave.

    I hoping that a good description of why these two controls behave
    differently will lend itself to me being able to come up with the correct
    code.

    "Give a man a bucket of fish and he'll eat for a day. Teach him how to fish
    and he'll eat for the rest of his life."

    Thank you

    Similar routine declarations:
    (Button)
    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles btnCancel.Click
    Response.Redirect("default.aspx")
    End Sub

    (DropdownList)
    Private Sub ddl_SelectedIndexChanged(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles ddl.SelectedIndexChanged
    End Sub
     
    Tony T, Feb 16, 2005
    #1
    1. Advertising

  2. Tony T

    Wilco Bauwer Guest

    Make sure the values of each item is different. If you have multiple
    items with the same value, and you select a different item which has
    the same value as the previously selected item, then the control will
    think you didn't change the selection at all.

    If this is not the case, then it might be due to incorrectly readding
    dynamically loaded controls. Dynamically loaded controls should be
    re-added upon postbacks. If this is not the case either, it is probably
    wise to post the actual code.
     
    Wilco Bauwer, Feb 16, 2005
    #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. Nathan Sokalski

    Order of events, databinding, and UserControls

    Nathan Sokalski, May 21, 2006, in forum: ASP .Net
    Replies:
    9
    Views:
    474
    Nathan Sokalski
    May 23, 2006
  2. seigo
    Replies:
    0
    Views:
    523
    seigo
    Aug 20, 2006
  3. Ibana
    Replies:
    0
    Views:
    341
    Ibana
    Oct 3, 2006
  4. JacekDr
    Replies:
    3
    Views:
    1,103
    Muhammad Naveed Yaseen
    Aug 26, 2007
  5. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    420
    Chris
    Aug 30, 2005
Loading...

Share This Page