Skip Navigation LinksASP.Net 2.0 Training : ASP.Net LinkButton
Banner for ASP.Net 2.0 training classes in Visual Basic 2005 

Skip Navigation Links
Visit my other site:

certification training

Free Flash tutorials and training

Free Dreamweaver Video Tutorials

Free PHP Training

Visual Basic Windows Training




If you like this site please link to it


LinkButton

  • The LinkButton control is used to create a hyperlink button.
  • This control looks like a HyperLink control but has the same functionality as the Button control!

Property

Description

CausesValidation

By default, a page is validated when a Button control is clicked. To prevent a page from being validated when clicking on a Button control, set this property to "false"

Command

The command associated with the Command event

CommandArgument

Additional information about the command to perform

id

A unique id for the control

OnClick

The name of the function to be executed when the link is clicked

runat

Specifies that the control is a server control.  Must be set to "server"

Text

The text to display for the link


Try this:

1

<script  runat="server">

2

Sub lblClick(sender As Object, e As EventArgs)

3

   Label1.Text="You clicked the LinkButton control"

4

End Sub

5

</script>

6

<html>

7

<body>

8

<form runat="server">

9

<asp:LinkButton Text="Click me!" OnClick="lblClick" runat="server" />

10

<p><asp:Label id="Label1" runat="server" /></p>

11

</form>

12

</body>

13

</html>

Save as: LinkButton.aspx

  • Open Visual Studio
  • Add a new webform
  • Name it linkButton.aspx
  • Click the Add button
  • Select the Design View
  • Add a linkButton to the webform
    • Change the text property to Click Me
  • Add a label control
    • Change the id to lblOutput
    • Erase the text property of the label control

  • Double-click the hyperlink control
  • Add this code:

lblOutput.text=”You clicked the linkButton.”

  • test it


      ASP.Net 2.0 tutorials & training