Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 22nd, 2009, 04:30 AM
Authorized User
 
Join Date: Jul 2006
Location: , , United Kingdom.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To sort Gridview Column by Time Only

Hi,
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.

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

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:18 PM.


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