Onlineatoz.net | ToolBox Standard Control TextBox

ToolBox Standard Control TextBox

TextBox Web Server Control

in ASP.NET environment,This article describes you how to work with Textbox Web Control.The user is able to entering information into this TextBox Web Control. The Information can be a Text, number, date and Password chars.

TextMode Propery
  • Single-line -Users type information in a single line. You can optionally specify the maximum character.
  • Password - Like a single-line TextBox control, but the characters are denoted by the asterisk(*) for the security purpose.
  • Multiline Users type information in a box that displays multiple lines and allows text wrapping.
TextBox Event

The TextBox control Performs a TextChanged event when the user leaves the control. By default, the event is not raised immediately; instead, it is raised on the server when the Web Forms page is submitted

Auto-completion feature

The major role of auto-completion is pulling up the text whatever we have typed before in the textbox.but which is depending on the browser. In general, browsers store values based on the text box's name attribute.if more textboxes contains the same name with different pages,then it provides the same details.Many browsers support an auto-completion feature that helps users fill information into text boxes based on values

The TextBox control supports an AutoCompleteType property that provides you with these options for controlling how the browser works with auto-completion:

  • Disable auto-completion. If you do not want the browser to offer auto-completion for a text box, you can disable it.
  • Specify a vCard value to use as the auto-completion value for the field. The browser must support the vCard schema.
To Get and Set Values in TextBox

the following code snippets demonstrates the set or get values of Textbox.

in .aspx.cs page,

protected void Button1_Click(object sender, System.EventArgs e)
{
 txt2.Text = txt1.Text;
}
 
To Respond to Changes in a TextBox
  • Create an event handler for the TextBox control's TextChanged event.

the following code snippets demonstrates respond to changes in TextBox.

in .aspx.cs page,

protected void txt1_TextChanged(object sender, EventArgs e)
{
   lbl1.Text = Server.HtmlEncode(txt1.Text);
}
 
Related Links

Posted by: Admin
Posted on: 9/14/2011 at 4:10 AM
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed