Exforsys

ASP.NET 2.0

  1. Getting started with ASP.NET 2.0
  2. .NET Framework Fundamentals
  3. Microsoft.NET Framework Tools
  4. Application Development in .NET
  5. What's New in the .NET Framework 2.0 ?
  6. Introduction to Visual Studio.NET
  7. Installing Visual Studio.NET 2005
  8. Working with Visual Studio.NET Web Applications
  9. Whats New in ASP.NET 2.0
  10. Creating an ASP.NET Application
  11. ASP.NET Code Directory
  12. ASP.NET Page Object Model
  13. ASP.NET Server Controls
  14. ASP.NET Working With Master Pages
  15. ASP.NET Creating Content for Master Page
  16. ASP.NET Referencing Master Page Members
  17. ASP.NET Changing Master Pages Dynamically
  18. ASP.NET Creating Nested Master Pages
  19. ASP.NET Working with Web Parts
  20. ASP.NET Using Web Parts and Controls in Web Pages
  21. ASP.NET Web Pages and Layout
  22. ASP.NET - Adding Web Parts at Run Time
  23. ASP.NET Personalization: User Profiles and Themes
  24. ASP.NET Data Access features
  25. ASP.NET State Management
  26. ASP.NET Customizing the Session State Mechanism
  27. ASP.NET State Management And Caching
  28. ASP.NET Security
  29. Forms Authentication in ASP.NET
  30. ASP.NET Managing Membership and Roles
  31. ASP.NET Configuring Page-Level Caching
  32. ASP.NET Setting Application-Level Caching
  33. ASP.NET Data Source Object Model
  34. ASP.NET SqlDataSource Control
  35. ASP.NET Data Bound Controls
  36. ASP.NET GridView Control
  37. ASP.NET GridView Filtering
  38. ASP.NET Adding Sorting and Paging in GridView
  39. ASP.NET DataBound Controls - Details View
  40. ASP.NET Using a Grid to Display Detail Information
  41. ASP.NET Displaying Master-Detail Data on the Same Page
  42. Displaying Master-Detail Data on Separate Pages in ASP.NET
  43. ASP.NET Creating Web Wizards
  44. ASP.NET : Dynamic Image control
  45. ASP.NET Advanced Site Functionality

Ads


Home arrow Technical Training arrow ASP.NET 2.0

ASP.NET DataBound Controls - Details View

Page 1 of 3
Author : Exforsys Inc.     Published on: 13th Sep 2005    |   Last Updated on: 13th Mar 2011

ASP.NET : DataBound Controls - Details View

In this tutorial you will learn DetailView DataBound Control, To create a file system Web site, Connecting to SQL Server, Use a Drop-Down List as the Master and To test the drop-down list.

Ads

The DetailsView is a control that is complementary to the GridView control. It has been introduced in ASP.NET 2.0 to provide an ability to work with a single record or row from an associated data source. The default view of this control is vertical with each column of the record displayed on a line of its own. It is used for updating and inserting new records and used often in the Master-details scenario where the details of the record selected in the master is displayed in detail.

The DetailsView, like the GridView rides on the data source capabilities to update, insert or delete rows. It renders a single data item at a time even when the data source exposes more items. If the data object represents the ICollection interface or the underlying data source exposes the paging operation, the DetailsView can page over the data, provided the AllowPaging property is set to true. Users can also navigate between rows of data using this control.

The process of binding the DetailsView control to a data source is very simple. The DataSourceID property can be set declaratively or programmatically.

The AutoGenerateEditButton property, if set to True, enables editing operations and the DetailsView renders the edit button in addition to the other columns in the control. The Edit mode can be invoked pressing this button. The Edit user interface can be customized using Styles, DataControlField objects and templates.

The DetailsView control can be configured to display a Delete and insert button also. The AutoGenerateInsertButton, when set to true, generates a New button. The new button invokes the insert mode and appropriate user interfaces are rendered including the fields in the DataKeyNames collection. Using this collection the data source control can locate the unique row to be updated.

The DetailsView control user interface can be customized using Style properties such as HeaderRowStyle, RowStyle, AlternatingRowStyle and so on. Templates also can be used to customize this control. EmptyDataTemplate, HeaderTemplate, FooterTemplate and PagerTemplate are some of the templates available for this control.

A number of events can be used to customize the code including pre and post insert, update and delete data source events. This includes ItemCreated and ItemCommand events. There is no selected event in the DetailsView control as the current event is treated as the selected event.

The Control can also be used for rendering mobile devices.

Let us explore the potential of using DetailsView control by creating and executing a page that has such a control on it.

To create a file system Web site

1. Open Visual Web Developer.

2. On the File menu, click New Web Site.

3. The New Web Site dialog box appears.

4. Under Visual Studio installed templates, click ASP.NET Web Site.

5. In the Location box, enter the name of the folder where you want to keep the pages of your Web site.

6. In the Language list, select C#.

7. Click OK.

8. Visual Web Developer creates the folder and a new page named Default.aspx.

Connecting to SQL Server

1. In Server Explorer (Database Explorer), right-click Data Connections and choose Add Connection.

2. The Connection Properties dialog box is displayed:

3. Do the following:

.......a. Enter or select the name of the SQL Server


.......bb. Click Browse and select ExForSys as the database.

Ads

4. Click Test Connection, and if it works, click OK.

5. When finished, click OK.

6. The connection is added to Server Explorer.

Using a Drop-Down List as the Master

1. Switch to or open the Default.aspx page.

2. Switch to Design view.

3. Type Select Course by CourseId in the page and format the text as a heading.

4. From the Standard group in the Toolbox, drag a DropDownList control onto the page.

5. In the smart tag panel, select the Enable AutoPostBack check box.



 
This tutorial is part of a ASP.NET 2.0 tutorial series. Read it from the beginning and learn yourself.

ASP.NET 2.0

  1. Getting started with ASP.NET 2.0
  2. .NET Framework Fundamentals
  3. Microsoft.NET Framework Tools
  4. Application Development in .NET
  5. What's New in the .NET Framework 2.0 ?
  6. Introduction to Visual Studio.NET
  7. Installing Visual Studio.NET 2005
  8. Working with Visual Studio.NET Web Applications
  9. Whats New in ASP.NET 2.0
  10. Creating an ASP.NET Application
  11. ASP.NET Code Directory
  12. ASP.NET Page Object Model
  13. ASP.NET Server Controls
  14. ASP.NET Working With Master Pages
  15. ASP.NET Creating Content for Master Page
  16. ASP.NET Referencing Master Page Members
  17. ASP.NET Changing Master Pages Dynamically
  18. ASP.NET Creating Nested Master Pages
  19. ASP.NET Working with Web Parts
  20. ASP.NET Using Web Parts and Controls in Web Pages
  21. ASP.NET Web Pages and Layout
  22. ASP.NET - Adding Web Parts at Run Time
  23. ASP.NET Personalization: User Profiles and Themes
  24. ASP.NET Data Access features
  25. ASP.NET State Management
  26. ASP.NET Customizing the Session State Mechanism
  27. ASP.NET State Management And Caching
  28. ASP.NET Security
  29. Forms Authentication in ASP.NET
  30. ASP.NET Managing Membership and Roles
  31. ASP.NET Configuring Page-Level Caching
  32. ASP.NET Setting Application-Level Caching
  33. ASP.NET Data Source Object Model
  34. ASP.NET SqlDataSource Control
  35. ASP.NET Data Bound Controls
  36. ASP.NET GridView Control
  37. ASP.NET GridView Filtering
  38. ASP.NET Adding Sorting and Paging in GridView
  39. ASP.NET DataBound Controls - Details View
  40. ASP.NET Using a Grid to Display Detail Information
  41. ASP.NET Displaying Master-Detail Data on the Same Page
  42. Displaying Master-Detail Data on Separate Pages in ASP.NET
  43. ASP.NET Creating Web Wizards
  44. ASP.NET : Dynamic Image control
  45. ASP.NET Advanced Site Functionality
 

Comments