>How can I jump to another page from within a .NET ASP page? I have a
>drop down list that, when changed, causes my application to jump to a
>different page.
You can do it exactly like you would in ASP:
<select onchange="goto(this);">
<option value="http://www.yahoo.com">Yahoo</option>
<option value="http://www.msn.com">MSN</option>
</select>
<script type="text/javascript">
function goto(sel)
{
document.location.href = sel.options[sel.selectedIndex].value;
}
</script>
So if you're using a DropDownList and databinding, you could do this:
<asp:DropDownList id="myddl" runat="server"></asp:DropDownList>
...
myddl.DataSource = //whatever
myddl.DataBind();
myddl.Attributes.Add("onchange", "goto(this);");
Or if you don't want to do it the client-side way, you can have your select
box auto post back and you can handle the event:
<asp:DropDownList id="myddl" AutoPostBack="True"></asp:DropDownList>
...
(event handler for SelectedIndexChanged)
public void myddl_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect( myddl.SelectedItem.Value );
}
HTH,
adam..
---
You are currently subscribed to dotnet as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
---------
Administrated by 15 Seconds : http://www.15Seconds.com
List Archives/Search : http://local.15Seconds.com/search
Subscription Information : http://www.15seconds.com/listserv.htm
Advertising Information: http://www.internet.com/mediakit/