3. Label Control:
The label control is used to display a static text or a message to the
user on the form.
The label control is normally used along with other controls.
Common examples is wherein a label is added along with the
textbox control.
The label gives an indication to the user on what is expected to fill
up in the textbox.
This is server side control, asp provides own tag to create label. The
example is given below.
< asp:LabelID=“lblname" runat="server" Text=“Name" ></asp:Label>
4. Label Control Property
Property Description
AccessKey It is used to set keyboard shortcut for the label.
BackColor It is used to set background color of the label.
BorderColor It is used to set border color of the label.
BorderWidth It is used to set width of border of the label.
Font It is used to set font for the label text.
ForeColor It is used to set color of the label text.
Text It is used to set text to be shown for the label.
ToolTip It displays the text when mouse is over the label.
Visible To set visibility of label on the form.
Height It is used to set height of the label.
Width It is used to set width of the label.
5. Accepting User Information
Textbox Control.
Checkbox Control.
Radiobutton Control
Button Control
Link Button Control
Image Button Control
Image map Control
6. Textbox Control:
Textbox control is most usable web server control in asp.net.
TextBox control is a rectangular box which is used to take user to input.
In simple word the TextBox is a place where user can input some text on
asp.net web form.
To use TextBox on page we can write code or just drag and drop from toolbox.
A text box control can accept one or more lines of text depending upon the
settings of the TextMode attribute.
< asp:LabelID=“lblname" runat="server" Text=“Name" ></asp:Label>
< asp:TextBoxID=“txtname" runat="server" ></asp:TextBox>
7. Textbox Control Property
Property Description
ID Identification name of textbox control.
Text It is used to display text in a textbox.
BackColor It is used to set background color of textbox control.
ForColor It is used to set text color of the textbox.
ToolTip It displays a text on control when mouse over on it.
CssClass It is used to apply style on textbox.
Enable true/false – used to enable or disable textbox.
TextMode Single / Multiline / Password
CausesValidation true/false – It is used to enable or disable validation effect on textbox
Visible true/false – It is used to hide or visible textbox on web page.
ReadOnly true/false – used to enable or disable textbox readonly.
MaxLenght It is used to set maximum number of characters that can be input in TextBox.
8. CheckBox Control:
• CheckBox control is an asp.net web server control.
• It is used to get multiple inputs from the user.
• It allows user to select choices from the set of choices.
• It takes user input in yes or no format. It is useful when we want multiple
choices from the user.
• To create CheckBox we can drag it from the toolbox in visual studio.
• CheckBox control visually as square on web forms. The Checkbox control
allow user to check square or uncheck square.
• In CheckBox control check and uncheck checkbox specify by the checked
property of check box true or false.
• If checkbox control square ticked then checked = true and unchecked then
checked=false.
• Checkbox control allow user to do either checked(tick) or unchecked (untick)
the checkbox control in asp.net.
• <asp:CheckBox ID="Chkred" runat="server" Text="RED" />
9. CheckBox Control Property
Property Description
AccessKey It is used to set keyboard shortcut for the checkbox.
BackColor It is used to set background color of the checkbox.
BorderColor It is used to set border color of the checkbox.
BorderWidth It is used to set width of border of the checkbox
Font It is used to set font for the checkbox text.
ForeColor It is used to set color of the checkbox text.
Text It is used to set text to be shown for the checkbox.
ToolTip It displays the text when mouse is over the checkbox.
Visible To set visibility of checkbox on the form.
Height It is used to set height of the checkbox.
Width It is used to set width of the checkbox.
Checked It is used to set check state of the checkbox either true or false.
10. RadioButton Control:
It is an input control which is used to takes input from the user.
To create RadioButton we can drag it from the toolbox of visual studio.
This is a server side control and ASP.NET provides own tag to create it.
Radiobutton is used to allow user to select a single radiobutton from group of
radiobutton.
A Radio button is used to showcase a list of items.
< asp:RadioButtonID="Rdomale" runat="server" Text="Male" GroupName="g
ender"/>
< asp:RadioButtonID="Rdofemale" runat="server" Text=“Female" GroupName
="gender"/>
11. Radiobutton Control Property
Property Description
AccessKey It is used to set keyboard shortcut for the Radiobutton.
BackColor It is used to set background color of the Radiobutton.
BorderColor It is used to set border color of the Radiobutton.
BorderWidth It is used to set width of border of the Radiobutton.
Font It is used to set font for the Radiobutton text.
ForeColor It is used to set color of the Radiobutton text.
Text It is used to set text to be shown for the Radiobutton.
ToolTip It displays the text when mouse is over the Radiobutton.
Visible To set visibility of Radiobutton on the form.
Height It is used to set height of the Radiobutton.
Width It is used to set width of the Radiobutton.
Checked It is used to set check state of the Radiobutton either true or false.
GroupName It is used to set name of the radio button group.
12. ButtonControl:
Displays a push button control on the Web page.
The Push button can be a command button or a submit button.
A command button has a command name and permits us to create multiple buttons on a page.
When a command button is clicked, we can also implement an event handler to control the actions to be
performed.
A Submit button does not have a command name and when the button is clicked, it posts the web
page back to the server.
When a submit button is clicked, we can also implement an event handler to control the actions to
be performed.
Some of the important properties of a button control are:
CausesValidation: This indicates whether validation will be performed when this button will be clicked. Here,
the Value can be set as true or false.
PostBackUrl: This specifies the URL of the page to post to from the current page when a button is clicked.
ValidationGroup: It enables you to specify which validators on the page are called when the button is
clicked. If no validation groups are established, a button click calls all of the validators that are on the page.
OnClientClick: Attach a client side (JavaScript) event that will fire when this button will be clicked.
OnClick: Raises the Click event of the Button control.
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="z-index: 1; left: 23px; top: 56px; position: absolute" Text="click!" />
13. LinkButtonControl
The LinkButton control is used to create a hyperlink-style button on the Web page.
This control looks like a Hyperlink control but almost has the functionality of the Button
control.
Despite being a hyperlink, you can't specify the target URL.
There is no UserSubmitBehavior property like the Button control with this control.
Some of the important properties of LinkButton Control are:
CausesValidation: This indicates whether validation will be performed when this button will be
clicked. Here, the Value can be set as true or false.
PostBackUrl: This Specifies the URL of the page to post to from the current page when the
LinkButton control is clicked.
ValidationGroup: The group of controls for which the LinkButton control causes validation when it
posts back to the server.
OnClick: Attach a server side method that will fire when this button will be clicked.
OnClientClick: Attach a client side (JavaScript) method that will fire when this button will be
clicked.
<asp:LinkButton ID="LinkButton1" runat="server" EnableTheming="True"
onclick="LinkButton1_Click"
style="z-index: 1; left: 24px; top: 194px; position: absolute"
ToolTip="Link to another page">LinkButton</asp:LinkButton>
14. ImageButton
Its like an ASP Button control, the only difference is, you have the ability to place your own image
as a button.
use an image Button when you want your button to look different than the plain
rectangular button.
Any image can be a button!.
Some of the important properties of an ImageButton Control are:
ImageUrl: Gets or Sets the location of the image to display as button control.
CausesValidation: This indicates whether validation will be performed when this button will be
clicked. Here, the Value can be set as true or false.
PostBackUrl: This Specifies the URL of the page to post to from the current page when the
LinkButton control is clicked.
OnClick: Attach a server side method that will fire when this button will be clicked.
OnClientClick: Attach a client side (JavaScript) method that will fire when this button will be
clicked.
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/images/smiley-guy.jpg" onclick="ImageButton1_Click"
style="z-index: 1; left: 16px; top: 294px; position: absolute; height: 80px;
width: 88px; right: 1177px; bottom: 421px" />
15. ImageMap control
The ImageMap control in ASP.NET 2.0 and onward versions can be used to create an image that
contains defined hot spot regions. When a user clicks a hot spot region, the control can either
generate a post back to the server or navigate to a specified URL.
There are three kinds of hot spot regions defined in ImageMap control.
• RectangleHotSpot
• CircleHotSpot
• PolygonHotSpot
• The RectangleHotSpot defines rectangular hot spot regions.
• The CircleHotSpotdefines circle-shaped ones
• The PolygonHotSpot is used for irregularly shaped hot spot area.
<asp:ImageMap ID="india" runat="server" ImageUrl="~/Map.jpg" Height="500px" Width="887px" HotSpotMode="PostBack" OnClick="india_C
lick" BackColor="#C0C000" BorderColor="DarkSlateGray" ForeColor="Red">
• <asp:CircleHotSpot Radius="7" X="215" Y="125" HotSpotMode="PostBack" NavigateUrl="~/map.aspx" PostBackValue="b
huj" AlternateText="Bhuj" />
• <asp:CircleHotSpot Radius="7" X="525" Y="95" HotSpotMode="PostBack" NavigateUrl="~/map.aspx" PostBackValue="pat
an" />
• <asp:CircleHotSpot Radius="7" X="565" Y="45" HotSpotMode="PostBack" NavigateUrl="~/map.aspx" PostBackValue="am
baji" />
• <asp:CircleHotSpot Radius="7" X="525" Y="150" HotSpotMode="PostBack" NavigateUrl="~/map.aspx" PostBackValue="m
e" />
• <asp:CircleHotSpot Radius="7" X="625" Y="120" HotSpotMode="PostBack" NavigateUrl="~/map.aspx" PostBackValue="hi