Previous Page
Next Page

Chapter 27 Quick Reference

To

Do this

Create a login Web form.

Create a new Web form. Add a Login control for authenticating users.

Configure security for an ASP.NET Web site.

Use the ASP.NET Web Site Administration Tool to add and maintain users, define roles, and create access rules.

Implement Forms-based security.

Edit the Web.config file. Set the <authentication mode> attribute to Forms, provide the URL of the login form, and specify any authentication parameters required. For example:

<authentication mode="Forms">
    <forms loginUrl="LoginForm.aspx"
           timeout="5"
           cookieless="AutoDetect"
           protection="All" />
</authentication>

Create a Web form for displaying data from a database.

Add a data source control to the Web form and configure it to connect to the appropriate database.

Add a GridView control to the Web form and set its Data SourceID property to the data source control.

Fetch and display data in manageable chunks in a Web form.

Set the AllowPaging property of the GridView control to True. Set the PagerSize property to the number of rows to be displayed on each page. Modify the PagerSettings and PagerStyle properties to match the style of the Web form.

Use caching with a data source control.

Set the EnableCaching property of the data source control to True. Set the timeout duration of the cache in seconds using the CacheDuration property. Specify whether this timeout value is absolute or relative to the last piece of activity using the CacheExpirationPolicy property.

Modify and delete rows in a database using a GridView control.

Ensure that the “Generate INSERT, UPDATE, and DELETE statements” option was selected when you generated the data source using the Configure Data Source Wizard, or use the Configure Data Source Wizard to add INSERT, UPDATE, and DELETE statements to an existing data source.

Using the GridView Tasks Smart Tag menu, check Enable Updating and Enable Deleting. Use the Edit Columns menu to set the display style of the Update and Delete links in the GridView control.


Previous Page
Next Page