Net-informations.com
SiteMap  | About    

Textbox Control

The TextBox server control is an input control which can be used to accept user input.

textbox-control

By default Texboxes comes with a single line of text , you can also use the TextBox control to display a multiline text box or a text box that masks user input by changing the value of the TextMode property to TextBoxMode.MultiLine

vb.net

  TextBox1.TextMode = TextBoxMode.MultiLine

C#

  TextBox1.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine;

If you want to limit the user input to a specified number of characters, set the MaxLength property.

vb.net

  TextBox1.MaxLength = 5

C#

  TextBox1.MaxLength = 5;

The following ASP.NET program retrieve user input from a TextBox control and display it to a Label control.

Defaul.aspx

  

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>Untitled Page</title>
</head>
<body>
	<form id="form1" runat="server">
	<div>
	   <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
	   &nbsp;
	   <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
	   &nbsp;
	   <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
	</div>
	</form>
</body>
</html>


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.cs
default.aspx.vb





net-informations.com (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.