Click here to Skip to main content
Click here to Skip to main content
Go to top

Advanced Paging GridView with ASP.NET 2.0/3.5

, 7 Nov 2008
Rate this:
Please Sign up or sign in to vote.
Advanced paging GridView with ASP.NET 2.0/3.5

Figure 1: The screen of ASP.NET 2.0 demo website

080925_2.JPG

Figure 2: The five extra new properties of WizardGridView

Introduction

This is an article about advanced paging GridView with ASP.NET 2.0/3.5. All the HTML, CSS, JavaScript it needs have been embedded into the WizardGridView.dll.

Background

Except advanced paging functionality of this GridView control, you know, when you create a new class that inherits from GridView class, the IntelliSense function inside of "Columns" tag will become invalid (see the code below). So I create two new classes - WizardTemplateField, WizardBoundField, directly inherit from Microsoft native TemplateField class and BoundField class and replace them in this WizardGridView control, and embedded into the WizardGridView.dll. Therefore, when you use this WizardGridView control in your ASPX page, the IntelliSense inside of "Columns" tag will become effective again.

Using the Code

Using this control in your ASP.NET project is so easy, like this:

<%@ Register Assembly="WizardGridView" Namespace="WizardGridView" TagPrefix="Wizard" %>

<Wizard:WizardGridView ID="WizardGridView1" runat="server" 
	AllowPaging="True" AllowSorting="True"
    AutoGenerateColumns="False" DataKeyNames="OrderID" DataSourceID="SqlDataSource1"
    WizardCustomPager="True">
    <Columns>
        <asp:BoundField DataField="OrderID" HeaderText="OrderID" 
			InsertVisible="False" ReadOnly="True"
            SortExpression="OrderID" />
        <asp:BoundField DataField="CustomerID" 
		HeaderText="CustomerID" SortExpression="CustomerID" />
        <asp:BoundField DataField="OrderDate" 
		HeaderText="OrderDate" SortExpression="OrderDate" />
        <asp:BoundField DataField="ShipName" 
		HeaderText="ShipName" SortExpression="ShipName" />
        <asp:BoundField DataField="ShipCity" 
		HeaderText="ShipCity" SortExpression="ShipCity" />
    </Columns>
</Wizard:WizardGridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
		ConnectionString="<%$ ConnectionStrings:ConnString_SqlClient %>"
    SelectCommand="SELECT [OrderID], [CustomerID], [OrderDate], 
		[ShipName], [ShipCity] FROM [Orders]">
</asp:SqlDataSource>
        

or with IntelliSense like this:

<Wizard:WizardGridView ID="WizardGridView1" runat="server" 
		AllowPaging="True" AllowSorting="True"
    AutoGenerateColumns="False" DataKeyNames="OrderID" DataSourceID="SqlDataSource1"
    WizardCustomPager="True">
    <Columns>
        <asp:WizardBoundField DataField="OrderID" 
		HeaderText="OrderID" InsertVisible="False" ReadOnly="True"
            SortExpression="OrderID" />
        <asp:WizardTemplateField ... />

History

  • 25th September, 2008 - Original posting, version 1.0, five new properties of this control have been added. You can find them in Visual Studio 2005/2008 "Property" window.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

WizardWu
Web Developer
Taiwan Taiwan
A young programmer in Taipei City, Taiwan. Earn little money and just coding for fun.

Comments and Discussions

 
QuestionIssue in the next and previous navigation Pinmemberboodi_8120-Jan-12 1:19 
GeneralRow_command does not fire Pinmemberebot6424-Feb-11 3:18 
I wanted to implement the gridview row command on this control and its not working. How can I make it to work?? Thanks. The control is wonderful...
GeneralMy vote of 5 PinmemberROHANCV30-Aug-10 20:09 
GeneralMy vote of 3 PinmemberROHANCV30-Aug-10 20:08 
Questionhow can use command argument in this component ? Pinmembermaziyar21-Aug-10 11:05 
Rantuse english or how to install your language Pinmemberykorotia21-Nov-08 9:09 
Generalif any problem, please tell us PinmemberWizardWu24-Sep-08 20:21 
GeneralRe: if any problem, please tell us PinmemberSupermanDT1-Oct-08 2:04 
GeneralRe: if any problem, please tell us PinmemberWizardWu5-Oct-08 1:03 
GeneralRe: if any problem, please tell us Pinmembermishraloke15-Aug-10 5:29 
GeneralRe: if any problem, please tell us PinmemberWizardWu16-Aug-10 5:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 7 Nov 2008
Article Copyright 2008 by WizardWu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid