Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DropdownList, RadioButtonList Events in UserControls

Thread Tools

DropdownList, RadioButtonList Events in UserControls

Tony T
Posts: n/a
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

"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:
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
End Sub

Private Sub ddl_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ddl.SelectedIndexChanged
End Sub

Reply With Quote
Wilco Bauwer
Posts: n/a
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.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with Button Events in dynamic usercontrols Ibana ASP .Net 0 10-03-2006 06:53 PM
Problem with Button Events with dynamic usercontrols Ibana Software 0 10-03-2006 05:49 PM
PlaceHolder and UserControls with Events seigo ASP .Net 0 08-20-2006 12:09 AM
Order of events, databinding, and UserControls Nathan Sokalski ASP .Net 9 05-23-2006 04:32 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM