SpeakComputers.com
Home
Software
Electronics
Desktop Computers
Laptops
Games
Handheld Devices
Mobile Phones
Cameras
Camcorders
Printers
Books
Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010
ASP.NET C# VB.NET C++ .NET Infragistics DevComponents

ASP.NET LinkButton Control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

The ASP.NET LinkButton is used as a hyperlink type button. The control is rendered as a HTML anchor (a) element.

Working example.

Click this to change color.

Creating the LinkButton control.
From the above example.

<asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Blue" OnClick="LinkButton1_Click">Click this to change color.</asp:LinkButton>

The above example will be rendered as HTML with the result below (source).

<a id="ctl00_ContentPlaceHolder1_LinkButton1" href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$LinkButton1','')" style="color:Blue;">Click this to change color.</a>

Responding to the click event.

<script runat="server"> protected void LinkButton1_Click(object sender, EventArgs e)
{
if (this.LinkButton1.ForeColor == System.Drawing.Color.Blue)
{
this.LinkButton1.ForeColor = System.Drawing.Color.Red; return;
}
if (this.LinkButton1.ForeColor == System.Drawing.Color.Red)
{
this.LinkButton1.ForeColor = System.Drawing.Color.Blue; return;
}

}
</script>

Computer Security
AntiVirus Software
Internet Security
Parental Controls
Backup & Recovery
Computer Protection
Anti Malware
Photo & Video
Photo & Video Editing
Video Music
Desktop Publishing
Professional Design
Home Publishing
Clipart
Business & Accounting
Accounting
Payroll
Check Printing
TAX
H&R Block
Microsoft Office
Design
Graphic Design
Home Design
Garden Design
Interior Design
Computer Aided Design
3D Design
Students & Teacher
Adobe
Microsoft Office
Dragon Naturally Speaking
Corel Draw
Serif
Student/Teacher Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
Home About Privacy Policy Resouces