After changing the SQL statement, what must one do to reload the
DataSet and use it to populate the databound control?
Ans: Call the DataBind method of the control where the data is to
be displayed.
I don't get any compiler errors when I run my ASP.Net
project with this repeater, but I don't get any output.
What is wrong?
Ans: There are no templates. Here are some possible templates
HeaderTemplate, ItemTemplate, AlternatingTemplate, SeperatorTemplate,
FooterTemplate.
What are the steps to inserting a new row in a database table?
Ans: Create and configure a Connection object, create and configure
a Command object with an INSERT SQL statement and connection, call the
ExecuteNonQuery for the command object, close the connection.
Applying CSS Classes to Asp.Net Controls
Here is how to create a CSS class and apply it to a control
using VS:
Add a stylesheet named styles.css to the project:
Project >> Add New Item >> Choose Stylesheet Templage >> Change the
name to styles.css
Attach the stylesheet to page1.css: Format >> Attach stylesheet.
Select styles.css.
Add a new class named .orange: right click on stylesheet >>
Add style rule >> Click Class name >> Enter orange for class name >>
Click OK.
Set the properties and values of .orange: Select .orange on the
stylesheet >> Right click on the stylesheet >> Build style >>
Add the desired properties and values for .orange.
Attach the class to a control: Go to the properties window of the
control >> Set the CssClass.
Password Encryption
Modern login systems all use some sort of password encryption.
In one of the simplest systems, used in Example 69 (login-page2.aspx),
use a one-way hash algorithm, like SHA (Shared Hash Algorithm).
The encoded passwords are stored in a file on the server. When a user
logs in, his or her password is encoded and compared with with the encoded
passwords and usernames in the file. If there is a match, the
login is successful.
For Example 69, the encrypted passwords are stored in
Base-64. Here is a Base-64
Conversion Table for converting binary data to base-64 and
vice versa.
Practice Problem. Convert the following hex data into
base-64:
4E A2 9B 73
More Controls
LinkButton Set the PostBackUrl to http://www.disney.com.
ImageButton Use
mickey.jpg as the image; also set the
PostBackUrl to http://www.disney.com.
ImageMap Here is a
map of the USA that could be used
in an ImageMap control.
Master Pages
Sometimes several pages in a website contain common information.
An alternative to copying the same common items to each page
in the website is to use a master page: take the items
that are repeated on each content page and move these items to a master
page where they are entered only entered once.
The items that are unique are placed on the content pages.
Each content page has a reference to its master page.
See Example 68 (Master Pages).
Cookies
A cookie is a piece of data that server-side application
stores on the users harddrive.
Cookies usually have an expiration date, at which point in time
they are erased.
ASP.Net stores cookie information in an HttpCookie object.
Use Request.Cookies to obtain an HttpCookie from the user's harddrive.
Use Response.Cookies to write a cookie to the user's harddrive.
Cookies should not be used to store sensitive information like
credit card numbers.
Cookies are often used to store information entered on forms to
save the user the trouble of entering the same information repeatedly.