I'm a newcomer to the world of .Net and I'm looking to create a button that will redirect from one page to another. Here's the C# code I'm working with:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.UserControl
{
protected void Page_Load(object sender, System.EventArgs e)
{
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
}
#endregion
protected void Button2_Click(object sender, System.EventArgs e)
{
Response.Redirect("Default2.aspx", true);
}
}
And here's the corresponding .NET code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<button id="Button2" onclick="Button2_Click" type="button" runat="server">NEW Account</button>
My ASPX file is named Default, and my ASPX.CS file is also named Default. THANKS!