Click here to Skip to main content
11,581,063 members (64,511 online)
Click here to Skip to main content
Add your own
alternative version

GridView:Sorting & Paging Using Generics And Nullable Datatype Function Of C# GetValueOrDefault()

, 8 Dec 2008 CPOL 40.3K 645 28
This article demonstrate the Sorting mechanism for Nullable datatype when used with IList collection.
Sorting And Paging
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CountryView.aspx.cs" Inherits="SortingAndPaging.CountryView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <title>Sorting And Paging</title>
    <form id="form1" runat="server">
            <asp:GridView runat="server" ID="gridCountry" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" EmptyDataText="No Data Found" PageSize="5" OnPageIndexChanging="gridCountry_PageIndexChanging"
                OnRowCreated="gridCountry_RowCreated" OnSorting="gridCountry_Sorting" BorderColor="#404040" BorderWidth="1px" BorderStyle="Solid" ForeColor="#404040">
                    <asp:TemplateField HeaderText="Int:Country ID" SortExpression="CountryID">
                    <asp:TemplateField HeaderText="String:Country Name" SortExpression="CountryName">
                    <asp:TemplateField HeaderText="Nullable Int:Country Trade Code" SortExpression="CountryTradeCode">
                <HeaderStyle BackColor="DarkOrange" Font-Bold="True" ForeColor="White" BorderColor="DarkGray" BorderStyle="Solid" Font-Names="Arial Unicode MS" Font-Size="Small" />
                <RowStyle BorderColor="#404040" BorderStyle="Solid" Font-Names="Trebuchet MS" Font-Size="Small" />
                <AlternatingRowStyle BackColor="Bisque" BorderColor="#404040" BorderStyle="Solid"
                    BorderWidth="1px" Font-Names="Trebuchet MS" Font-Size="Small" />

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


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


About the Author

santosh poojari
Technical Lead
India India
Whatsup-->Exploring--> MVC/HTML5/Javascript & Virtualization.......!

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150603.1 | Last Updated 8 Dec 2008
Article Copyright 2008 by santosh poojari
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid