Professional Documents
Culture Documents
Slide 1
Objectives
Applied Given the specifications for a web form that uses any of the server controls presented in this chapter, design and code the form. Knowledge Describe the normal coding technique for handling control events. Describe the way ASP.NET provides for setting access keys for controls and for setting the default focus and default button for forms. Describe the differences between buttons, link buttons, and image buttons. Describe the use of the e argument when working with an image button control.
Slide 2
Objectives (continued)
Describe the use of the Command event and the CommandName property of a button control for processing a group of button controls. Describe the differences between the way check box controls and radio button controls work, including the difference in when the CheckedChanged event occurs. Explain how the items in any of the list controls are stored and how you refer to these items in code. Explain the purpose of the ListItem Collection Editor and describe when you might use it.
Slide 3
Standard controls
Commonly used user input controls such as labels, text boxes, and drop-down lists Many can be bound to a data source
Data controls
Databound user-interface controls that display data via a data source control Data source controls that access data from a variety of databases, XML data sources, and business objects
Validation controls
Used to validate user input Work by running client-side script Can handle most validation requirements
Slide 4
Navigation controls
Controls that provide menus and path maps for navigating a web site
Login controls
Controls that provide user authentication
WebParts controls
Controls that let you create a page from user-selectable components
Slide 5
HTML controls
Standard HTML controls that can be converted to HTML server controls Not commonly used in ASP.NET applications
Slide 6
Slide 7
Slide 8
Slide 9
The asp tags for two button controls that use the same event handler
<asp:Button id="btnPrevious" runat="server" Text="Previous" OnClick="NavigationButtons_Click" /> <asp:Button id="btnNext" runat="server" Text="Next" OnClick="NavigationButtons_Click" />
Slide 10
Slide 11
A form that uses access keys and default focus and button attributes
Slide 12
Slide 13
Slide 14
Slide 15
Slide 16
Slide 17
An image used for an image button control The asp tag for the control
<asp:ImageButton ID="ibtnNavigate" runat="server" ImageUrl="~/Images/navbuttons.gif" Height="24px" Width="96px" OnClick="ibtnNavigate_Click" />
Slide 18
Slide 19
Description An integer that represents the x or y coordinate where the user clicked the image button.
Slide 20
Slide 21
Slide 22
CommandArgument
Description The value specified in the CommandName property for the control that generated the Command event. The value specified in the CommandArgument property for the control that generated the Command event.
Slide 23
Slide 24
Slide 25
Slide 26
Slide 27
The aspx code for the check boxes and radio buttons
<asp:CheckBox ID="chkMail" runat="server" Checked="True" Text="Add me to your mailing list" /><br /><br /> Contact me about:<br /> <asp:CheckBox ID="chkSpecial" runat="server" Text="Special offers" /><br /> <asp:CheckBox ID="chkNew" runat="server" Text="New products" /><br /> <asp:CheckBox ID="chkRelated" runat="server" Text="Related products" /><br /><br /> Contact me by:<br /> <asp:RadioButton ID="rdoEmail" runat="server" Checked="True" GroupName="Contact" Text="Email" /> <asp:RadioButton ID="rdoPostal" runat="server" GroupName="Contact" Text="Postal mail" />
Slide 28
Slide 29
Slide 30
Slide 31
Slide 32
Slide 33
Slide 34
Slide 35
Description The text thats displayed for the list item. A string value associated with the list item. Indicates whether the item is selected.
Slide 36
Slide 37
Slide 38
Code that loads items into a drop-down list using ListItem objects
ddlDay.Items.Add(new ddlDay.Items.Add(new ddlDay.Items.Add(new ddlDay.Items.Add(new ddlDay.Items.Add(new ddlDay.Items.Add(new ddlDay.Items.Add(new ListItem("Sunday", "1")) ListItem("Monday", "2")) ListItem("Tuesday", "3")) ListItem("Wednesday", "4")) ListItem("Thursday", "5")) ListItem("Friday", "6")) ListItem("Saturday", "7"))
Slide 39
Slide 40
Slide 41
Slide 42
Slide 43
RepeatDirection
RepeatColumns
Slide 44
A statement that gets the value of the selected item in a radio button list
customer.MailType = rblMail.SelectedValue;
A statement that checks if the first item in a check box list is selected
if (cblContact.Items[0].Selected) ...
Slide 45
Slide 46
Slide 47
Slide 48
A statement that checks if the first link button in a bulleted list was clicked
if (blstCategories.Items[0].Selected) ...
Slide 49
Slide 50
Slide 51
Slide 52
Slide 53
Slide 54
Slide 55
Description If True, the user has selected a file to upload. The name of the file to be uploaded.
The HttpPostedFile object that represents the file that was posted. You can use this objects ContentLength property to determine the size of the posted file. Method Description SaveAs(string) Saves the posted file to the specified path.
Slide 56
Slide 57
Slide 58
Slide 59
Slide 60
Slide 61
Slide 62
SelectedDate
SelectedDates
Slide 63