Skip to main content

Text Boxes and Labels Control in Asp.net



Text Boxes and Labels:

Text box controls are typically used to accept input from the user. A text box control can accept one or more lines to text depending upon the setting of the TextMode attribute.
Label controls provide an easy way to display text which can be changed from one execution of a page to the next. If you want to display a text that does not change, you use the literal text.
Basic syntax for text controls:
<asp:TextBox ID="txtstate" runat="server" ></asp:TextBox
Common Properties of the Text Box and Labels:
Property
Description
TextMode
Specifies the type of text box. SingleLine creates a standard text box, MultiLIne creates a text box that accepts more than one line of text and the Password causes the characters that are entered to be masked. The default is SingleLine.
Text
The text content of the text box
MaxLength
The maximum number of characters that can be entered into the text box.
Wrap
It determines whether or not text wraps automatically for multi-line text box; default is true.
ReadOnly
Determines whether the user can change the text in the box; default is false, i.e., the user can change the text.
Columns
The width of the text box in characters. The actual width is determined based on the font that's used for the text entry
Rows
The height of a multi-line text box in lines. The default value is 0, means a single line text box.
The mostly used attribute for a label control is 'Text', which implies the text displayed on the label.

Comments

Popular posts from this blog

List Controls: List Box and Drop Downlist

ASP.Net provides the controls: drop-down list, list box, radio button list, check box list and bulleted list. These control let a user choose from one or more items from the list. List boxes and drop-down list contain one or more list items. These lists could be loaded either by code or by the ListItem Collection Editor. Basic syntax for list box control: <asp:ListBox ID="ListBox1"        runat="server"        AutoPostBack="True"        OnSelectedIndexChanged="ListBox1_SelectedIndexChanged"> </asp:ListBox> Basic syntax for a drop-down list control: <asp:DropDownList ID="DropDownList1"       runat="server"       AutoPostBack="True"       OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> </asp:DropDownList>

Sql CharIndex Function

The CHARINDEX  function returns the starting position of the specified expression in a character string. Example: Search for "t" in string "DotNetReceipe", and return position: SELECT CHARINDEX( 't' , 'DotNetReceipe' ) AS Position;