1. ASP.NET Introduction 2. Comp of .Net Framework 3.5 3. Sys.Req for VS 2008 4. ASP.NET Envrmnt Setup 5. VS2010 Ultimate Sys.Req 6. Installing VS 2010 7. VS 2012 Sys.Req 8. Installing VS Exp 2012 9. Start the VS 2008 10. Application Life Cycle 11. Page Life Cycle 12. Page Life Cycle Events 13. ASP.NET Example 14. Event Handling 15. Default Events 16. Server Side 17. Request Object 18. Response Object 19. Server Controls 20. Server Controls Properties 21. Server Controls Methods 22. HTML Server Controls 23. Client Side 24. ASP.NET Basic Controls 25. TextBox Control 26. CheckBox Controls 27. RadioButton Controls 28. ListBox Control 29. HyperLink Control 30. Image Control 31. BulletedList Control 32. ASP.NET Directives 33. Implements Directive 34. Master Type Directive 35. Page Directive 36. PreviousPage Type 37. Managing State 38. Control State 39. Cookies 40. Query Strings 41. Server-Side State 42. Session State 43. Validation Controls 44. Required FieldValidator 45. Range Validator 46. Compare Validator 47. RegularExpressionValidator 48. Custom Validator 49. Validation Summary 50. Data Source Control 51. AdRotator Control 52. Calendar Control 53. Calendar Control Example 54. Panel Control 55. Panel Control Example 56. Multi Views Control 57. MultiView & View controls 58. MultiView Control Example 59. FileUpload Control 60. FileUpload Control Eg 61. AJAX Control 62. UpdatePanel control 63. UpdateProgress Control 64. Custom Controls 65. Custom Control Eg 66. Personalization 67. Create Simple Profile 68. ADO.NET 69. ADO.NET Objects 70. DataTable 71. DataRow 72. DataColumn 73. Object Example 74. Error Handling 75. Tracing Errors 76. Debugger 77. Security 78. Authentication 79. Authorization 80. LINQ 81. LINQ Query Operators 82. LINQ Example 83. Caching 84. Data Caching 85. Output Caching 86. Object Caching 87. Web Services 88. Create Web Services Eg 89. Web & Machine.config 90. Settings Schema 91. ASP.NET Deployment 92. XCopy Deployment 93. Web Setup Project 94. ASP Interview Part 1 95. ASP Interview Part 2 96. ASP Interview Part 3 97. ASP Interview Part 4 98. ASP Interview Part 5 99. ASP Interview Part 6
Pr.Pg Next Pg

TextBox Control tutorials

  • The TextBox server control is an input control that lets the user enter text. By default, the TextMode   property of the control is set to  TextBoxMode.SingleLine, which displays a single-line text box.

  • You can configure it to be single-line or multiline, or to act as a password entry box, hiding the text being typed in it. If you set it to multiline, it automatically wraps the text it contains unless the Wrap property is set to false. Its Textproperty sets and retrieves the text content within the box. The text it contains can exceed the length of the control displayed on the page, in which case the beginning of the text is scrolled off to the left of the box.



The basic syntax of TextBox Control is:

<asp: TextBox ID= “txtname” runat= ”server”></asp:TextBox>

  • Common Properties of TextBox Conntrols are:





Determines the AutoComplete behavior of the TextBox control


Gets or sets a value that indicates whether an automatic postback to the server occurs when the TextBox control loses focus.


Determines whether validation is performed when the TextBox control is set to validate when a postback occurs


display width of the text box in characters.


Specifies maximum number of characters allowed in the text box.


Gets or sets a value indicating whether the contents of the TextBox control can be changed.


Determines the number of rows displayed in a multiline text box.


SpecifiesThe contents of the textbox


Specifies the behavior mode (single-line, multiline, or password) of the TextBox control


The group of controls that is validated when a Postback occurs


Specifies whether the text content wraps within a multiline text box


specifiesThe name of the function to be executed when the text in the textbox has changed.

TagKey Property

Gets the HTML tag for the text box control, This property is protected.



  • The below Example, We have one TextBox control, one Button control, and one Label control in an TextBoxControl..aspx file. When the submit button is clicked the submit subroutine is executed. The submit subroutine writes a text to the Label control. Which is shown in the below codes.

TextBoxControl.aspx.cs Code:


Following example shows the use of ASP.NET Basic Web Controls(TextBox Controls):

Sam Sir


using System;

using System.Collections;

using System.Configuration;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;


public partial class TextBoxControl : System.Web.UI.Page


protected void Page_Load(object sender, EventArgs e)




protected void btnsubmit_Click(object sender, EventArgs e)


lblmsg.Text = "Your name is: " + TextBox1.Text;






TextBoxControl.aspx Code:



Following example shows the use of ASP.NET Basic Web Controls(TextBox Controls):

Sam Sir


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TextBoxControl.aspx.cs" Inherits="TextBoxControl" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">


<html xmlns="">

<head runat="server">

<title>cbtSAM ASP.NET TextBox Control example</title>



<form id="form1" runat="server">


Enter Your Name:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>




<asp:Button ID="btnsubmit" runat="server" Text="Submit"

onclick="btnsubmit_Click" />



<asp:Label ID="lblmsg" runat="server" Text=""></asp:Label>










After running the web forms it will display following result: example


Pr.Pg border                                              Next Pg