Mega Code Archive

 
Categories / ASP.Net / Response
 

Redirect a URL (C#)

<%@ Page Language="c#" %> <script Language="c#" runat="server">   void Page_Load(object source, EventArgs e)   {     if (!(IsPostBack))     {        MyButton.Text = "OK";       MyDropDownList.Items.Add("http://www.rntsoft.com");       MyDropDownList.Items.Add("http://www.rntsoft.com");     }   }   public void Click (object sender, EventArgs e)   {     Response.Redirect(MyDropDownList.SelectedItem.Text);   } </script> <html>   <body>     <form id="WebForm1" method="post" runat="server">       <asp:DropDownList id=MyDropDownList runat="server"/>       <asp:button id=MyButton runat="server" OnClick="Click" Text=""/>     </form>   </body> </html>