Answers for Day 9

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Appendix A.  Answers to Quiz Questions


Quiz

1:

What namespaces must you import to use data mechanisms in your ASP.NET pages?

A1:

System.Data, and optionally either System.Data.OleDb or System.Data.SQL. These provide additional methods and objects that allow you to work with databases.

2:

True or False: The DataSet can contain multiple tables.

A1:

True.

3:

What are the three collections of the DataSet, and what do they do?

A1:

Tables Holds all DataTable objects.

ExtendedProperties Holds additional information about a data store, such as usernames and passwords.

Relations Holds information on relations defined between DataTables.

4:

What is the syntax for data-binding expressions?

A1:

 <%# property or collection %> 
5:

Does the DataList control support paging?

A1:

No, it doesn't inherently support paging.

6:

What are the two properties of a DataGrid that you must specify to turn on sorting and paging, respectively?

A1:

 AllowSorting="true" AllowPaging="true" 

Exercise

Q1:

Enhance the planner application from exercise 2 in Day 6 to use data binding. Bind the DayLabel to the Calendar's selectedDate, and format it properly.

A1:

The code is the same as before, with the following changes:

In planner.ascx Add a method call to DataBind in the Page_Load event, inside the postback check, and also to the end of the SelectionChanged method, after the if statement.

Remove the lines DayLabel.Text = (Calendar1.SelectedDate).Format("dddd, MMMM dd yyyy", nothing ) and DayLabel.Text = (obj.SelectedDate).Format("dddd, MMMM dd yyyy", nothing ) from the Page_Load and SelectionChanged events, respectively.

Add the line Text='<%# Calendar1.SelectedDate.Format("dddd, MMMM dd yyyy", nothing ) %>' to the declaration of DayLabel.

Be sure to import the System.Data namespace!


    IOTA^_^    
    Top


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net