STANDARD CONTROL
(1) Button Controls:
ASP .Net provides three types of button controls: buttons, link buttons and image buttons. As the names suggest a button displays text within a rectangular area, a link button displays text that looks like a hyperlink.
And an Image Button displays an image.When a user clicks a button control, two events are raised Click and Command.
Basic syntax for button controls:
<asp:Button ID="Button1" runat="server"
onclick="Button1_Click" Text="Click" />
(2) 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
(3) Check Boxes and Radio Buttons:
A check box displays a single option that the user can either check or uncheck and radio buttons present a group of options from which the user can select just one option.
To create a group of radio buttons, you specify the same name for the GroupName attribute of each radio button in the group. If more than one group is required in a single form specify a different group name for each group.
If you want a check box or radio button to be selected when it's initially displayed, set its Checked attribute to true. If the Checked attribute is set for more than one radio button in a group, then only the last one will be selected.
Basic syntax for check box:
<asp:CheckBox ID= "chkoption" runat= "Server">
</asp:CheckBox>
Basic syntax for radio button:
<asp:RadioButton ID= "rdboption" runat= "Server">
</asp: RadioButton>
(4) List Controls:
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>
It is important to notes that:
...To work with the items in a drop-down list or list box, you use the Items property of the control. This property returns a ListItemCollection object which contains all the items of the list.
... The SelectedIndexChanged event is raised when the user selects a different item from a drop-down list or list box.
(5) The List Item Collections:
The ListItemCollection object is a collection of ListItem objects. Each ListItem object represents one item in the list. Items in a ListItemCollection are numbered from 0.
When the items into a list box are loaded using strings like: lstcolor.Items.Add("Blue") . then both the Text and Value properties of the list item are set to the string value you specify.
To set it differently you must create a list item object and then add that item to the collection.
The ListItem Collection Editor is used to add item to a drop-down list or list box. This is used to create a static list of items.
To display the Collection Editor select Edit item from the smart tag menu, or select the control and then click the ellipsis button from the Item property in the Properties window.
(6) Radio Button list and Check Box list
A radio button list presents a list of mutually exclusive options. A check box list presents a list of independent options. These controls contain a collection of ListItem objects that could be referred to through the Items property of the control.
Basic syntax for radio button list:
<asp:RadioButtonList ID="RadioButtonList1"
runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
</asp:RadioButtonList>
Basic syntax for check box list:
<asp:CheckBoxList ID="CheckBoxList1"
runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
</asp:CheckBoxList>
(7) Bulleted lists and Numbered lists:
The bulleted list control creates bulleted lists or numbered lists. These controls contain a collection of ListItem objects that could be referred to through the Items property of the control.
Basic syntax of a bulleted list:
<asp:BulletedList ID="BulletedList1" runat="server">
</asp:BulletedList>
(8) HyperLink Control:
The HyperLink control is like the HTML <a> element.
Basic syntax for a hyperlink control:
<asp:HyperLink ID="HyperLink1" runat="server">
HyperLink
</asp:HyperLink>
(9) Image Control:
The image control is used for displaying images on the web page, or some alternative text, if the image is not available.
Basic syntax for an image control:
<asp:Image ID="Image1" runat="server">
(10)Wizard Control
The Wizard control is a more advanced version of the MultiView control. It has built-in yet customizable behavior, including sidebar with step links, style, and navigation buttons. Generally, Wizards represent a single task and user moves, from the current step to the next or immediately preceeding step in case he/she wants modification.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <table> tag.
(11) File Upload :
FileUpload control allows users to upload file to the web hosting server. When it is rendered on the page, it is implemented through <input type=file /> HTML tag. Its properties like BackColor, ForeColor, BorderColor,BorderStyle, BorderWidth, Height etc. are implemented through style properites of <input>.
(12) Calendar
Ideally Calendar control is used to display calendar for a month and allows to navigate backward & forward through days, and months. This control is highly customizable in terms of functionality and appearance.
When it is rendered on the page, it is implemented through combination of <table>, <tr> and <td> HTML tag. Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <table>, <tr> and <td> tags.
(13) Panel
Panel control is generally used to keep a set of controls into it. It is frequently used when you have to programmatically generate controls. When it is rendered on the page, generally it is implemented through <div> HTML tag.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <input> tag.
(1) Button Controls:
ASP .Net provides three types of button controls: buttons, link buttons and image buttons. As the names suggest a button displays text within a rectangular area, a link button displays text that looks like a hyperlink.
And an Image Button displays an image.When a user clicks a button control, two events are raised Click and Command.
Basic syntax for button controls:
<asp:Button ID="Button1" runat="server"
onclick="Button1_Click" Text="Click" />
(2) 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
(3) Check Boxes and Radio Buttons:
A check box displays a single option that the user can either check or uncheck and radio buttons present a group of options from which the user can select just one option.
To create a group of radio buttons, you specify the same name for the GroupName attribute of each radio button in the group. If more than one group is required in a single form specify a different group name for each group.
If you want a check box or radio button to be selected when it's initially displayed, set its Checked attribute to true. If the Checked attribute is set for more than one radio button in a group, then only the last one will be selected.
Basic syntax for check box:
<asp:CheckBox ID= "chkoption" runat= "Server">
</asp:CheckBox>
Basic syntax for radio button:
<asp:RadioButton ID= "rdboption" runat= "Server">
</asp: RadioButton>
(4) List Controls:
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>
It is important to notes that:
...To work with the items in a drop-down list or list box, you use the Items property of the control. This property returns a ListItemCollection object which contains all the items of the list.
... The SelectedIndexChanged event is raised when the user selects a different item from a drop-down list or list box.
(5) The List Item Collections:
The ListItemCollection object is a collection of ListItem objects. Each ListItem object represents one item in the list. Items in a ListItemCollection are numbered from 0.
When the items into a list box are loaded using strings like: lstcolor.Items.Add("Blue") . then both the Text and Value properties of the list item are set to the string value you specify.
To set it differently you must create a list item object and then add that item to the collection.
The ListItem Collection Editor is used to add item to a drop-down list or list box. This is used to create a static list of items.
To display the Collection Editor select Edit item from the smart tag menu, or select the control and then click the ellipsis button from the Item property in the Properties window.
(6) Radio Button list and Check Box list
A radio button list presents a list of mutually exclusive options. A check box list presents a list of independent options. These controls contain a collection of ListItem objects that could be referred to through the Items property of the control.
Basic syntax for radio button list:
<asp:RadioButtonList ID="RadioButtonList1"
runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
</asp:RadioButtonList>
Basic syntax for check box list:
<asp:CheckBoxList ID="CheckBoxList1"
runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
</asp:CheckBoxList>
(7) Bulleted lists and Numbered lists:
The bulleted list control creates bulleted lists or numbered lists. These controls contain a collection of ListItem objects that could be referred to through the Items property of the control.
Basic syntax of a bulleted list:
<asp:BulletedList ID="BulletedList1" runat="server">
</asp:BulletedList>
(8) HyperLink Control:
The HyperLink control is like the HTML <a> element.
Basic syntax for a hyperlink control:
<asp:HyperLink ID="HyperLink1" runat="server">
HyperLink
</asp:HyperLink>
(9) Image Control:
The image control is used for displaying images on the web page, or some alternative text, if the image is not available.
Basic syntax for an image control:
<asp:Image ID="Image1" runat="server">
(10)Wizard Control
The Wizard control is a more advanced version of the MultiView control. It has built-in yet customizable behavior, including sidebar with step links, style, and navigation buttons. Generally, Wizards represent a single task and user moves, from the current step to the next or immediately preceeding step in case he/she wants modification.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <table> tag.
(11) File Upload :
FileUpload control allows users to upload file to the web hosting server. When it is rendered on the page, it is implemented through <input type=file /> HTML tag. Its properties like BackColor, ForeColor, BorderColor,BorderStyle, BorderWidth, Height etc. are implemented through style properites of <input>.
(12) Calendar
Ideally Calendar control is used to display calendar for a month and allows to navigate backward & forward through days, and months. This control is highly customizable in terms of functionality and appearance.
When it is rendered on the page, it is implemented through combination of <table>, <tr> and <td> HTML tag. Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <table>, <tr> and <td> tags.
(13) Panel
Panel control is generally used to keep a set of controls into it. It is frequently used when you have to programmatically generate controls. When it is rendered on the page, generally it is implemented through <div> HTML tag.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <input> tag.
0 comments:
Post a Comment