Please visit our sponsors !
Button Control
Definition and Usage
The Button control is used to display a push button. The push button may be a
submit button or a command button. By default, this control is a submit button.
A submit button does not have a command name and it posts the Web page
back to the server when it is clicked. It is possible to write an event handler
to control the actions performed when the submit button is clicked.
A command button has a command name and allows you to create multiple Button
controls on a page. It is possible to write an event handler to control the actions performed when the
command button is clicked.
Properties
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" |
CommandArgument |
Additional information about the command to perform |
CommandName |
The command associated with the Command event |
id |
A unique id for the control |
OnClick |
The name of the function to be executed when the button is
clicked |
runat |
Specifies that the control is a server control. Must
be set to "server" |
Text |
The text on the button |
Example 1
In the following example we declare a submit Button
control in an .aspx file. Then we create an event handler for the Click event which changes the text on
the button:
<script runat="server">
Sub submit(Source As Object, e As EventArgs)
b1.Text="You clicked me!"
End Sub
</script>
<html>
<body>
<form runat="server">
<asp:Button id="b1" Text="Click me" runat="server"
OnClick="submit" />
</form>
</body>
</html>
|
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|