Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics 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 April 16th, 2008, 01:03 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default Date/Time presentation in a GridView

I am using a stored procedure in my web application and following definition:

CREATE TABLE #JobListTable
        (
            job_date datetime,
            job_number char(15),
            cost_code char(15),
            qty_delivered decimal(8,2),

When I display the data in a web page and a GridView the date comes up as:

4/15/2008 12:00:00 AM
4/16/2008 12:00:00 AM

When I display the data using Windows from and DataGridView the date comes up as:

4/15/2008
4/16/2008

How can I manipulate the the result only to show date in my web page (without changing anything in my stored procedure)?
 
Old April 18th, 2008, 04:58 AM
Authorized User
 
Join Date: Sep 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you using AutoGenerateColumn? If yes, then skip the following.

Open the form in designer view. Select grid and click F4 (properties). Click that ... button besides Columns (collection) and Fields-dialog pops up.

Select appropriate field from the Selected fields - list. At the properties list at the right switch HtmlEncode to False. Then insert your format string to DataFormatString field. I think simple 'd' (without apostrophes) will do fine.
 
Old April 18th, 2008, 08:24 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Hello weicco:

That was cool and it worked perfectly. I was able to do some other nice adjustments. Thank you, that saved me a lot of work and saved my day.....







Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting Time from Date/Time Navy1991_1 XSLT 2 June 3rd, 2008 12:03 PM
date and time in EST time zone anboss XSLT 1 May 21st, 2008 01:42 PM
How to retieve only the date not date and time debjanib ASP.NET 1.0 and 1.1 Professional 2 July 25th, 2006 01:10 PM
Master/Detail Data Presentation in GridView AbrarNazeer ASP.NET 2.0 Professional 0 June 22nd, 2006 12:59 AM
insert system date. no date and time jimmy Access VBA 6 November 20th, 2003 01:11 PM





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