rkneal
asked on
OnClick Event in A Select Dropdown Menu (ASP)
Is it possible to have an onClick event fired off when something is selected from a Select dropdown list in ASP? Similar to how a button when clicked performs an action I would like when an item is selected from a dropdown list that it immediately opens a new page. This way it does not require the user to select the item from the drop down, then hit a submit button.
this is what I used for one of my buttons.
<input type="button" value="Refresh" onClick="location.href='<% = Me.NewURL.ToString() %>';">
Is there a way to use this method for a dropdown? Something like
<input type="dropdown" value="Refresh" onClick="location.href='<% = Me.NewURL.ToString() %>';">
this is what I used for one of my buttons.
<input type="button" value="Refresh" onClick="location.href='<%
Is there a way to use this method for a dropdown? Something like
<input type="dropdown" value="Refresh" onClick="location.href='<%
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Shank - What you have does work but I get a prompt when I click an item from the drop down. The prompt says
"Javascript: A script has requested that a new URL be loaded. Do you wish to load http://XXX.XX"
This happens on a blackberry browser. If I click Yes, it opens the page but if I can get fix this prompt then that would be all I need. Any ideas?
"Javascript: A script has requested that a new URL be loaded. Do you wish to load http://XXX.XX"
This happens on a blackberry browser. If I click Yes, it opens the page but if I can get fix this prompt then that would be all I need. Any ideas?
ASKER
Works to accomplish what I want but I have to find out a way around an annoying prompt.
You can simply do something like:
<asp:DropDownList ID="ddl" runat="server" OnSelectedIndexChanged="dd
<asp:ListItem .../>
</asp:DropDownList>
And in code behind:
Protected Sub ddl_OnSelectedIndexChanged
Response.Redirect(Me.NewUR
End Sub
/Carl.