Click here to Skip to main content
Licence CPOL
First Posted 24 Sep 2008
Views 56,003
Downloads 1,305
Bookmarked 49 times

Advanced Paging GridView with ASP.NET 2.0/3.5

By WizardWu | 7 Nov 2008
Advanced paging GridView with ASP.NET 2.0/3.5
3 votes, 30.0%
1

2

3
3 votes, 30.0%
4
4 votes, 40.0%
5
3.33/5 - 10 votes
μ 3.33, σa 3.11 [?]

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)

About the Author

WizardWu

Web Developer

Taiwan Taiwan

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

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionIssue in the next and previous navigation Pinmemberboodi_812:19 20 Jan '12  
GeneralRow_command does not fire Pinmemberebot644:18 24 Feb '11  
GeneralMy vote of 5 PinmemberROHANCV21:09 30 Aug '10  
GeneralMy vote of 3 PinmemberROHANCV21:08 30 Aug '10  
Questionhow can use command argument in this component ? Pinmembermaziyar12:05 21 Aug '10  
Rantuse english or how to install your language Pinmemberykorotia10:09 21 Nov '08  
Generalif any problem, please tell us PinmemberWizardWu21:21 24 Sep '08  
as title,
i wrote it in Traditional Chinese VS 2005,
i'm not sure is it could run correctly in English or other language IIS & VS 2005/2008.
 
if you use this GridView in your VS 2005/2008 have any problem, please leave message here.
thanks a lot.
Smile | :)
GeneralRe: if any problem, please tell us PinmemberSupermanDT3:04 1 Oct '08  
GeneralRe: if any problem, please tell us PinmemberWizardWu2:03 5 Oct '08  
GeneralRe: if any problem, please tell us Pinmembermishraloke6:29 15 Aug '10  
GeneralRe: if any problem, please tell us PinmemberWizardWu6:02 16 Aug '10  

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.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120210.1 | Last Updated 7 Nov 2008
Article Copyright 2008 by WizardWu
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid