Help: Events not executing

G

Guest

Hi Everyone,
I'm having a problem trying to get the program to execute the
SelectedIndexChanged event for a Dropdownlist (Combobox). I double clicked
the control to get the event in the Code-Behind file. I have the following
declare :
Protected Sub cmbPORequests_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cmbPORequests.SelectedIndexChanged
if cmbPORequests.SelectedValue > 0 then
BindGrid(cmbPORequests.SelectedValue )
end if
End Sub

When I select a new item in the control, the event is not executed. I even
tried to add the following to the markup:
<asp:DropDownList ID="cmbPORequests" runat="server" DataTextField=""
OnSelectedIndexChanged="cmbPORequests_SelectedIndexChanged"
DataValueField="" Style="left: 298px; top: 109px" Width="175px">
</asp:DropDownList>
This didn't work either. One question I did have was: Do I need to set the
AutoPostBack property to true? From my reading I get the feeling I don't need
to, but wanted to make sure. Any comments would help. Thanks.
Michael
 
G

Guest

Hi Everyone,
I've done some testing and have found that if I have AutoPostBack set to
true, I get the event, BUT ONLY AFTER I click a command button. It seems that
it has put the events in a queue. If I turn off AutoPostback, the event for
the combo is never executed. I need the form to respond right away to the
SelectedIndexChanged event so that it can load the correct data in a grid.
Thanks for any advice.
Michael
 
B

Brock Allen

AutoPostBack works if javascript is working in the page. If not, then the
form has to wait until the user has hit the submit button.
 
G

Guest

Hi Brock,
Thanks for the reply. I'm not sure if I got all the setting right, but I
went into the Intoernet options > Security
I enabled "Allow scripting of Internet Explorer Webbrowser controls"
Already enabled "Scripting of Java applets"
Java permissions = High safty (Does this one need to be changed)

I made sure of the above settings and ran the project, and it didn't work
again, at least not when the I select an item from the dropdownlist. Only
after clicking on one of commad buttons. What do you think. Thanks again so
much for the reply.
Michael
 
J

Jeff Dillon

What happens if you create a new blank page, drop a server dropdownlist on
it, double-click on it to get to the code behind, and put in some code for
the selectedindexchanged event. Does this work?
 
G

Guest

Hi Jeff,
I created a new project, added a master page and a content page and on the
content page I added a dropdownlist. For the SelectedIndexChanged event I
just added a msgbox call. It works with the AutoPostback set to true. What
does this you. Is there something in the web.config file that may need to be
changed? Thanks again for the help.
Michael
 
G

Guest

Thanks for the help. I have it working now. Installing java may have
corrected something. Its working great now. Thanks for all that helped.
Michael
 
J

Jeff Dillon

I'm confused. Is it working, or not?

When I do this, I don't have to set anything..it just works. And keep in
mind you can't call MsgBox, it runs on the server!

Jeff
 

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,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top