Link Button Control in asp.net
For Example: Write a program to demonstrate the use of link button control
.aspx File:
<html >
<head runat="server">
<title>Aryan Comomputers(LinkButton Control) </title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Font-Bold="True"
Font-Names="Arial Unicode MS" ForeColor="#006600" Text="Link Button Control"></asp:Label>
</div>
<p>
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">C++ Programming</asp:LinkButton>
</p>
<p>
<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">Java Programming</asp:LinkButton>
</p>
<asp:Label ID="Label2" runat="server" Text="."></asp:Label>
</form>
</body>
</html>
.CS File:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication14
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Label2.Text = "You Click on C++ Programming";
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Label2.Text = "You Click on Java Programming";
}
}
}
Output:
Comments
Post a Comment