Redirect Based on Dropdownlist.

Jayakumars
Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 860
Hi

I have Post Redirect Option Based on Dropdownlist

Server Side
===========

protected void DrpRedirect_SelectedIndexChanged(object sender, EventArgs e)
{

if (DrpRedirect.SelectedValue == "1")
{
Response.Redirect("Home.aspx");
}
else
if (DrpRedirect.SelectedValue == "2")
{
LinkButton lnk = new LinkButton();
lnk.PostBackUrl = "Home.aspx";
lnk.Text = "Home";
form1.Controls.Add(lnk);
}
else
if (DrpRedirect.SelectedValue == "3")
{
Response.Write("<script>window.location.href='Home.aspx';</script>");
}

}

Client Side
=============

<asp:DropDownList ID="DrpRedirect" runat ="server" AutoPostBack="True"
onselectedindexchanged="DrpRedirect_SelectedIndexChanged" >
<asp:ListItem Text ="Server Side Redirect" Value ="1"></asp:ListItem>
<asp:ListItem Text ="Link Button Redirect" Value ="2"></asp:ListItem>
<asp:ListItem Text ="Client Side Redirect" Value ="3"></asp:ListItem>
</asp:DropDownList>

Comments or Responses

Login to post response