Web Studyaspnet.blogspot.com Babyneed.blogspot.com

ASP.Net Web Developer Guide

Power By: eXTReMe Tracker Powered by Blogger  
 
 
 
 

 

 
Important Links
 
   
     
 
Sitemap
 
   
   
 
Reference
 
   

Tuesday, March 21, 2006

Using ASP.NET Web Controls(chapter 3)

The ASP.NET Web controls are also known as Web form controls. Microsoft has included a plethora of Web controls in the System.Web.UI.WebControls namespace.For discussion purposes, we will divide these controls into three major categories:
  1. Basic Web Controls These Web controls are similar to HTML server controls but have additional features.These controls have a richer andmore consistent object model.

  2. Validation Controls These controls have been developed exclusively for input validation (to be discussed later in this chapter).

  3. Databound ListControls These belong to the new generation of controls that provide additional power and development speed.These arealso typically referred to as Templated Web Controls.All Web controls are derived from the generic class named WebControl. Thus,the Web controls inherit a common set of class members. Some of the frequentlyused members include BackColor, BorderColor, BorderStyle BorderWidth, DataBind,Enabled, Font, ForeColor, Height, Page, Parent, Site, TabIndex, ToolTip ,Visible , Init, Load, Unload, Dispose ,ToString , OnInit , OnLoad , and OnDataBinding
Basic Web ControlsTable 3.2 briefly describes several server controls that we have classified as basic Web controls. Some of these controls behave similarly. For example, the usagesand characteristics of a CheckBoxList control are almost identical to those of aRadioButtonList control.This is why we have grouped these controls under singlecaptions in Table 3.2.Table 3.2 Basic Server ControlsServer Control CharacteristicsLabel A Label is used to display text. If we want to display static
  1. text, we do not need a Label server control; we should instead use HTML. We should use a Label server controlonly if we need to change its properties via server code.

  2. TextBox A TextBox control enables the user to enter text. By default, the TextMode property is SingleLine, but it canalso be set to Multiline or Password. In case of Multilinetext box, the Rows property determines the height. If itsAutoPostBack property is set to True, it generates aPostBack on its Text_Changed() event.

  3. Buttons: All three types of buttons cause PostBacks when the user clicks them.

  4. Button Button controls can be placed inside other container controls, such as DataList, DataGrid and Repeater.

  5. LinkButton The LinkButton renders a hyperlink in the page.

  6. _ImageButton The ImageButton displays an image that responds to mouse clicks. We can also use it as an image map. Thus,we may pinpoint where in the graphic the user has clicked.

  7. CheckBox It enables the user to input Boolean data: true or false, yes or no. Its Checked property can also be bound to a datafield of a data source. Its CheckedChanged event can beused for AutoPostBack.

  8. ListControls: These controls are derived from the ListControl abstract

  9. CheckBoxList class. Note: these controls will be discussed in detail in a

  10. DropDownList later section of this chapter.

  11. ListBox

  12. RadioButtonList

  13. HyperLink It displays a link to another page. It is typically displayed as text specified in its Text property. It can also be displayedas an image specified in the ImageUrl property. Ifboth the Text and ImageUrl properties are set, theImageUrl property is displayed. If the image does not exist,then the text in the Text property is shown. InternetExplorer uses the Text property to display ToolTip.

  14. Image We may use the Image control to display an image on the Web page. The ImageUrl property specifies the path to thedisplayed image. When the image does not exist, we canspecify the text to display in place of the image by settingthe AlternateText property. The Image control only displaysan image. If we need to capture mouse clicks on theimage, we should instead use the ImageButton control.

  15. Panel This can be used as a container of other controls. This control is rendered as an HTML <div> element.

  16. RadioButton It creates an individual radio button on the page. We can group them to present mutually exclusive choices.

  17. Table It enables us an HTML table. A table can be built at design time with static content, but the Table control is oftenbuilt programmatically with dynamic contents.Programmatic additions or modifications to a table rowor cell do not persist on PostBack. Changes to table rowsor cells must be reconstructed after each post to theserver. In these cases, better alternatives are DataList orDataGrid controls.

  18. Xml This control can be used to transform XML documents. Many of the basic server controls work very similarly to their HTML server control counterparts. All of the Web controls are prefixed with asp: in their tags. For example, the tag for a label Web control is <asp:Label>.Their uses are also mostly intuitive. All of the examples illustrated in the HTML server control section can also be effectively developed using Web controls. In this section we will present a number of additional examples to demonstrate the uses of Web controls.



0 Comments:

Post a Comment

<< Home