Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta charset="utf-8" /> <title></title> <style> #Button1, #Button2 { cursor: pointer; } </style> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="facebook" OnClick="Button1_Click" /> <asp:Button ID="Button2" runat="server" Text="youtube" OnClick="Button2_Click" /> <br /> <br /> <br /> <asp:HyperLink ID="HyperLink1" runat="server" Visible="false"></asp:HyperLink> </div> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta charset="utf-8" /> <title></title> <style> #Button1, #Button2 { cursor: pointer; } </style> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="facebook" OnClick="Button1_Click" /> <asp:Button ID="Button2" runat="server" Text="youtube" OnClick="Button2_Click" /> <br /> <br /> <br /> <asp:HyperLink ID="HyperLink1" runat="server" Visible="false"></asp:HyperLink> </div> </form> </body> </html>
Default.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { HyperLink1.Visible = true; HyperLink1.Target = "_blank"; HyperLink1.Text = "facebook.com"; HyperLink1.NavigateUrl = "http://facebook.com/"; } protected void Button2_Click(object sender, EventArgs e) { HyperLink1.Visible = true; HyperLink1.Target = "_blank"; HyperLink1.Text = "youtube.com"; HyperLink1.NavigateUrl = "http://youtube.com/"; } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { HyperLink1.Visible = true; HyperLink1.Target = "_blank"; HyperLink1.Text = "facebook.com"; HyperLink1.NavigateUrl = "http://facebook.com/"; } protected void Button2_Click(object sender, EventArgs e) { HyperLink1.Visible = true; HyperLink1.Target = "_blank"; HyperLink1.Text = "youtube.com"; HyperLink1.NavigateUrl = "http://youtube.com/"; } }