Friday, 28 February 2014

ASP .NET Controls

LinkButton Control:
The link button control behaves in exactly the same way as the button but the server will convert it into an HTML <a> tag rather than an HTML input submit control. This control appears to be a hyper link but acts like a button, unlike a hyper link it posts back by using JavaScript code.

Image Button Control:
The image button control as you might expect is a button that uses an image. Note that unlike the link button control the image button doesn't need to use any JavaScript to submit the form.
The alternate test property of image button control is exclusive to images. Alternate text was originally intended for users of text only browsers where the browser couldn't display an image the alternate text is displayed instead. Although today every major web browser is able to display images, alternate text is still useful for two reasons: one is that the search engines use alternate text to identify which keywords to attach to an image, the second reason is that visually impaired users can use alternate text in conjunction with speech detect software.
The button, link button and image button controls provide a choice of three different appearances for your buttons.

Label and Literal Control:
It doesn't have any text so a place holder is shown instead. Label and Literals controls normally display their text property on the page. Visual studio adds place holder text when the text property is empty as otherwise you wouldn't be able to the control in the design view. A label control has its text property set to 'Label' when it is created, if you clear the text property of label control it will still appear in design view with its ID property. A literal control's text property is blank when it is first created. It appears in design view with its ID property until the text property has been set. When the text property is blank the control won't acctually display any text in the user's browser. The label control is the best choice when you simply want to display text in the user's browser.

TextBox Control:
It is one of the most common controls in ASP.NET. The text box control provides the easiest way to provide users of your site to input text.

CheckBox Control:
A CheckBox is simply a box that a user can check or uncheck, you have probably seen them while browsing the internet. In the same way as all ASP .NET controls, the CheckBox is converted into HTML when the page is sent to a web browser. The checkbox control is based on the HTML input(checkbox) control but has more features. Although it is possible to use the controls from HTML category in ASP .NET, its almost always better to use ASP .NET equivalent from the standard category of the tool box.
Note if you want to create a page with lots of CheckBox choices you should be aware of the CheckBoxList control. CheckBoxList controls works very similarly to DropDown list controls except the items are shown as the check boxes instead of a drop down menu.

RadioButton Control:
Radio buttons are very similar to check boxes but only allow user to choose one option at a time. The RadioButtonList control is similar to the CheckBox list control as it allows you to create a group of radio buttons in the same way as you create a DropDown list control. In most cases the RadioButtonList control is preferable to the RadioButton control as it automatically assigns the radio buttons to the same group. The events for all of the radio buttons are also grouped together.

DropDownList Control:
DropDownList control is similar to the CheckBox and RadioButton controls. Items in DropDownList are allowed to have both a text value that is shown to the user and another value that is hidden from the user but is visible to your C# code. The value is specially used when your DropDownList control is linked to items in a database. Each item in the DropDownList control is automatically assigned a unique index number.

RequiredFieldValidator Control:
One thing you often want to do with online forms is to validate the user's input to make sure that they are entering everything correctly. Although you could validate input using a combination of C# and JavaScript. ASP .NET provides a series of controls that will automatically generate the validation code for you, the RequiredFieldValidator is one of those. A RequiredFieldValidator simply make sure that the user has entered something into the control it validates.

RangeValidator Control:
The RabgeValidator Control allows you to check that the user has entered correct type of value and allows you to restrict the value to a range. The ValidationSummary control lets you easily display a list of validation error messages to let the user know what they have entered incorrectly. The RangeValidator control is intended to restrict a value to a specific type and range.

CompareValidator Control:
The CompareValidator control is used when you want to validate by comparing one control with another.

CustomValidator Control:
The CustomValidator control allows you to enter your own JavaScript code to be used for validation.

RegularExpressionValidator Control:
The RegularExpressionValidator control allows you to validate using a regular expression.

ValidationSummary Control:
You can use a ValidationSummary control to show a list of validation problems.

Note that these are the details of the most commonly and frequently used controls. You can easily find the details of all the ASP .NET controls on the internet.

No comments:

Post a Comment