DropdownList, RadioButtonList Events in UserControls

T

Tony T

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
 
W

Wilco Bauwer

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top