Events don't fire

doraemon

Freshman
Joined
Oct 3, 2003
Messages
36
I have a combo box and a listbox on the ASP .Net form. When the user picks a value in the combo box field, I want to do something to load the respective data into the listbox. I placed the codes in the SelectedIndexChanged event of the combo box but it does not seem to fire. However, if I create another button and put the codes there, it will fire. I wonder if there is any way to fire up the codes without having to put that extra buttons; otherwise, I would end up having many buttons on the form if I create more list boxes to fill.

Similarly, I created 2 radio buttons. When I clicked on one, the other should be unclicked. I put the codes on the CheckChanged Event and the codes did not seem to fire either. Is there any trick to get those events fired?

:o
 
I actually just figured out to set the AutoPostBack property to true and those events would fire. But then the problem I got was that then my page will be reloaded (so everything was set back to the default value). How can I now have the page reloaded again?


doraemon said:
I have a combo box and a listbox on the ASP .Net form. When the user picks a value in the combo box field, I want to do something to load the respective data into the listbox. I placed the codes in the SelectedIndexChanged event of the combo box but it does not seem to fire. However, if I create another button and put the codes there, it will fire. I wonder if there is any way to fire up the codes without having to put that extra buttons; otherwise, I would end up having many buttons on the form if I create more list boxes to fill.

Similarly, I created 2 radio buttons. When I clicked on one, the other should be unclicked. I put the codes on the CheckChanged Event and the codes did not seem to fire either. Is there any trick to get those events fired?

:o
:confused:
 
Re:

In your Page_Load routine, place everything you don't want to run each time the page is posted back in the following...

Code:
If Not Page.IsPostBack Then
   blah blah blah...
End If

Everything in that IF..THEN statement will run only the first time the page is loaded and not after. This might be what you're looking to do if you're populating form controls with data, and only wish to do that the first time. Hope that helps!
 
Back
Top