Please visit our sponsors !
TextBox Control
Definition and Usage
The TextBox control is used to create a text box where the user can input
text.
Properties
Property |
Description |
AutoPostBack |
A Boolean value that specifies whether the form should be
posted immediately after the contents of the textbox has changed or not. Default is false |
Columns |
The width of the textbox |
id |
A unique id for the control |
MaxLength |
The maximum number of characters allowed in the textbox |
OnTextChanged |
The name of the function to be executed when the text in
the textbox has changed |
Rows |
The height of the textbox (only used if TextMode="Multiline") |
runat |
Specifies that the control is a server control. Must
be set to "server" |
Text |
The contents of the textbox |
TextMode |
SingleLine creates a text box with only one line. MultiLine creates a text
box with multiple lines. Password creates a one-line text box that masks the
value entered by the user. Default is SingleLine. Legal values are:
- SingleLine
- MultiLine
- Password
|
Wrap |
A Boolean value that indicates whether the contents of the
textbox should wrap or not |
Example 1
In the following example we declare one TextBox
control, one Button control, and one Label control in an .aspx file. When the submit button is triggered, the submit subroutine is executed. The
submit subroutine copies the contents of the textbox to the Label control:
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
lbl.Text=txt.Text
End Sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="txt" Text="Hello World!" Font_Face="Arial"
BackColor="darkblue" ForeColor="white" TextMode="MultiLine"
Height="50" runat="server"/>
<br /><br />
<asp:Button OnClick="submit" Text="Copy Text to Label"
runat="server"/>
<br /><br />
<asp:Label id="lbl" runat="server"/>
</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
|