Web Forms - TextBox control


  Translation results:

Web Forms is one of three programming patterns for creating ASP.NET websites and web applications.

The other two programming patterns are Web Pages and MVC (Model View Controller Model-View-Controller).

Web Forms is the oldest ASP.NET programming model and is an event-driven web page that integrates HTML, server controls, and server code.

Web Forms are compiled and executed on the server, and the server generates HTML to display as a web page.

Web Forms - TextBox controlsyntax

The TextBox control is used to create a text box into which the user can enter text.

Web Forms - TextBox controlexample

<!DOCTYPE html>
<html>
<body>
<form runat="server">
A basic TextBox:
<asp:TextBox id="tb1" runat="server" />
<br><br>
A password TextBox:
<asp:TextBox id="tb2" TextMode="password" runat="server" />
<br><br>
A TextBox with text:
<asp:TextBox id="tb3" Text="Hello World!" runat="server" />
<br><br>
A multiline TextBox:
<asp:TextBox id="tb4" TextMode="multiline" runat="server" />
<br><br>
A TextBox with height:
<asp:TextBox id="tb5" rows="5" TextMode="multiline" runat="server" />
<br><br>
A TextBox with width:
<asp:TextBox id="tb6" columns="30" runat="server" />
</form>
</body>
</html>

Home

Videos

Q&A