ASP.NET
  Home arrow ASP.NET arrow Page 3 - Introducing ASP.NET 2.0: GridView Control
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? 
ASP.NET

Introducing ASP.NET 2.0: GridView Control
By: Anand Narayanaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 64
    2005-07-11

    Table of Contents:
  • Introducing ASP.NET 2.0: GridView Control
  • Create the Database
  • Save and Run
  • Adding Paging Functionality to GridView
  • Updating Data

  • 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


    Introducing ASP.NET 2.0: GridView Control - Save and Run


    (Page 3 of 5 )

    Save and run the project by pressing the F5 key. Visual Web Developer Web Server automatically starts, and you will view the output in a new Internet Explorer Window (See Figure 8).

    Figure 8

    The above procedure doesn't require any coding. Visual Studio 2005 automatically does the required coding in the background. I have reproduced a snippet from the code to help give you a better understanding of what it is doing (See Listing 1).

    Listing 1

    <asp:GridView AutoGenerateColumns="False" DataKeyNames="Name,Price,Publisher" DataMember="DefaultView"

                DataSourceID="AccessDataSource1" ID="GridView1" runat="server">

                <Columns>

                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name"></asp:BoundField>

                    <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price"></asp:BoundField>

                    <asp:BoundField DataField="Publisher" HeaderText="Publisher" SortExpression="Publisher">

                    </asp:BoundField>

                </Columns>

            </asp:GridView>

            <asp:AccessDataSource DataFile="F:\CODEPUT_NEW\CODE\App_Data\Books.mdb" ID="AccessDataSource1"

                runat="server" SelectCommand="SELECT * FROM [books]"></asp:AccessDataSource>

    The path given along with the DataFile property may be different from the one given above while you are working with this lab. As you can see, very little code is required for populating a GridView control, and Visual Studio 2005 does the entire job for us.

    Let us now discuss some of the advanced functionalities which can be performed using the GridView control.

    More ASP.NET Articles
    More By Anand Narayanaswamy


       · I'm Aannd - the author of this article. Please go through the article and let me...
       · I can't get this to work. I keep getting the error...
       · Hi, i am rachel.i did the method as u posted here. but my delete button doesnt...
       · Did your @<column name> match what was in the "<asp:BoundField DataField="?
       · hi I am algo getting the same errror with delete action.sudha
       · hello, how about when xml is our datasource?
     

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ





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