16 February 2014

Buttons -Basic Web Controls

     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 Text Mode 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:text box Id:"Txtstate" runat="server"></asp:text box>
Common Properties of the Text Box and Labels:
Property
Description
Text Mode
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.
Read-only
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.   


Buttons :

   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" on click="button1_click" text="click"/>
Common Properties of the Button control:


Property                  
Description

Text                          
The Text displayed by the button .This is for the button and link button only
Image URL
For Image Button control only. The text to be displayed if the browser  can't display the image
Causes
Validation Determines whether page validation occur when a user clicks the button. The default is true
Command
Name a String value that's passed to the command event when user clicks the  button
Command  Argument
A string value that passed to the command event when use clicks the button
Post back URL            
URL of the page that should be requested when user clicks the button

Hyper Link

   The Hyperlink control is like the HTML <a> element.
Basic syntax for a hyperlink control:
       <asp: hyperlink id="hyperlink1" runat="server"> </asp:hyperlink>
Properties:

    ImageURL:Path of the image to be displayed by the control
    Navigate URL: Target link URL
    Text :The text to be displayed as the link
    Target:The window or frame which will load the linked page

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: check box Id="chkoption" runat="server"></asp:checkbox>
Basic syntax for radio button:
  <asp:radio button id="rbOption" runat="server"></asp:radio button>
Common Properties of the Check Boxes and Radio Buttons:
    Text           : The text displayed next to the check box and Radio button
    Checked      : Specifies whether it is selected or not ,default is false
    Group Name  : Name of the group the control belongs to 

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”>
Important Properties:
     Alternate text: Alternate text to be displayed
   Image Align: Alignment options for the control
   Image URL: Path of the image to be displayed by the control

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 List Item objects that could be referred to through the Items property of the control.
Basic syntax for radio button list:

<asp:radiobuttonlisId="Radiobuttonlist1"runat="server"autopostback="true" OnSleectedIndexChanged="Radiobuttonlist1_selectedindexchanged">
</asp: radiobuttonlist>
Basic syntax for check box list:
<asp:CheckboxlistId="CheckboxList1"Runat="Server"Autopostback="true" OnSleectedIndexChanged="CheckboxList1_selectedindexchanged"></asp:Checkboxlist >
Common Properties of Check Box and Radio Button Lists:
      Repeat Layout:This attribute specifies whether the table tags or the normal html flow to user while formatting the list when it is rendered.The default is table


     Repeat Direction:It specifies the direction in which the controls to be repeated.the values available are horizontal and vertical

    Repeat Columns:It specifies the number of columns to use when repeating the controls ,default is 0

1 comment: