ASP.NET LinkButton Control
Link Button Control is similar to Button Control. Everything is similar in properties and events,except that user can see it as a Link.
Syntax Of Link Button
<asp:LinkButton ID="LinkButton1"
runat="server" >Home</asp:LinkButton>
Properties
| Properties |
Discription |
| AccessKey |
specify a key that navigates to the Button control. |
| CommandArgument |
specify a command argument that is passed to the Command event. |
| CommandName |
specify a command name that is passed to the Command event. |
| Enabled |
disable the LinkButton control. |
| OnClientClick |
specify a client-side script that executes when the LinkButton is clicked. |
| PostBackUrl |
post a form to a particular page. |
| TabIndex |
specify the tab order of the LinkButton control. |
| Text |
label the LinkButton control. |
| Focus |
set the initial form focus to the LinkButton control. |
LinKButton Event
| Event |
Discription |
| Click |
occurs when the LinkButton control is clicked by the user. |
| Command |
occurs when the LinkButton control is clicked and passes its associated CommandName and CommandArgument to the server side event handler. |
.vb Code
Protected Sub LinkButton1_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles LinkButton1.Click
Label1.Text = "This is my Home Page"
End Sub
Protected Sub LinkButton2_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles LinkButton2.Click
Label1.Text = "My Company name R4r TechSoft Solution "
End Sub
Protected Sub LinkButton3_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles LinkButton3.Click
Label1.Text =
"My Name is Rituraj Tyagi And My Contact No... 9717009112"
End Sub
Output: