Database
  Home arrow Database arrow Page 2 - ADO.NET 101: Data Rendering with a DataLis...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE

ADO.NET 101: Data Rendering with a DataList Control Introduction
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 9
    2005-11-29

    Table of Contents:
  • ADO.NET 101: Data Rendering with a DataList Control Introduction
  • Displaying Data from DataReader with a DataList Control
  • Data from a DataReader
  • Designing the ItemTemplate
  • Displayed data from DataReader

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ADO.NET 101: Data Rendering with a DataList Control Introduction - Displaying Data from DataReader with a DataList Control


    (Page 2 of 5 )

    On the DataListExample.aspx page, drop the DataList Control by clicking and dragging it to the design pane of the web page as shown. The properties window is also shown in this picture. By default it will be named DataList1. But it is better to change it to some meaningful name.

    When the control is placed on the web form, the following code is added to the web page's HTML between the <form></form> tags as shown here with some default style information.

    In the design pane you may right click and add templates, of which the ItemTemplate is a required (must) item. If you right click and pick the Edit Template drop down menu, the various templates on the DataList control can be edited. 

    IDE related details of DataList Control

    In a manner very similar to the RepeaterControl, by just typing in a <, the intellisense's drop down menu will appear with a list of tags that can be inserted as shown here.

    The header and footer templates serve the purpose of providing the information that is suggested by their names. For example, these include the column names of a table in the header and some aggregate information, or a date in the footer. The ItemTemplate is where the row after row of data comes in. The Header and Footer templates are rendered only once since they are needed only once. If they are not defined, they are not rendered. The Alternating ItemTemplate is a part of the same ItemTemplate, but helps with optionally rendering the alternate rows of ItemTemplate for better readability of data. Again, it is rendered only if it is defined, not otherwise. The ItemTemplate is mandatory, however.

    Configuring the ItemTemplate

    This is an important step because ItemTemplate is a required item. This part of the control is what displays the main data from the database.

    More Database Articles
    More By Jayaram Krishnaswamy


       · In a series of articles I have tried to cover data rendering from an SQL Server...
     

    DATABASE ARTICLES

    - Database Programming in C# with MySQL : Usin...
    - Formatting Techniques for Data Access from E...
    - Data Access from Excel VBA
    - Generating a Multiple Table Crystal Report u...
    - ADO and the Command Object
    - On Wiring Up an ADO Data Control
    - Reading and Writing to Files on the Intranet
    - Using ADO Record to Create and Navigate Intr...
    - Using Data Access Pages to Access Data on a ...
    - Using ADO with the SQL Native Client
    - ADO`s Stream Object
    - Opening a Record Object Referencing an Open ...
    - Introducing Jasper (SQL Anywhere 10 Beta)
    - Creating a Database Project in VS 2005
    - Manipulating ADO Recordsets





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT