Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 22nd, 2009, 04:30 AM
Authorized User
Join Date: Jul 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To sort Gridview Column by Time Only

I have a gridview on page log it gets populated from a sql server db, however one of the columns (ReportTime) displays the time when the report was added to the db, and in one day we have many reportstherefore I need to sort this column (ReportTime) by time only.

i would be grateful is some one kindly help me to solve this problem.

 <asp:GridView ID="grdReports" runat="server" AutoGenerateColumns="False" 
          DataKeyNames="ReportId" AllowPaging="True" DataSourceID="odsReport" 
           AllowSorting="True" CssClass="Results" PageSize="100">
            <AlternatingRowStyle CssClass="AlternateRow" />
                    <asp:BoundField HeaderText="ID" DataField="ReportID"  
                              SortExpression="ReportID" />
                    <asp:TemplateField FooterText="Title" HeaderText="Title" 
                                    <asp:Label ID="lblReportTitle" runat="server" Text='<%# Bind 
                                                  ("ReportTitle") %>'></asp:Label>
                    <asp:TemplateField FooterText="Date" HeaderText="Date"  
                                    <asp:Label ID="lblReportDate" runat="server" Text='<%# Eval
                                        ("ReportDate", "{0:dd MMM yyyy HH:MM}")%>'></asp:Label>

Last edited by rao965; May 22nd, 2009 at 04:34 AM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
[2005] GridView sort problem snufse ASP.NET 2.0 Basics 7 February 12th, 2008 10:26 AM
Sort with gridview smithsf22 ASP.NET 2.0 Basics 1 December 9th, 2006 09:17 AM
GridView Sort (Top Urgent ) msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 02:34 AM
GridView sort without DataSet? drasko ASP.NET 2.0 Professional 1 October 3rd, 2006 06:57 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.