473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DataTablet, Datagrid, and DateTime

Hi all,

I've got a DataTable that has a datetime column that is bound to a datagrid.
The Datetime Column holds both Date *and* time, but my Datagrid only shows
the date. How would I go about getting it to display both Date *and* time?

regards,

Marco
Nov 15 '05 #1
2 3765
Hi Marco,

1. Configure the grid with a programmatically created DataGridTableStyle
pre-populated with DataGridColumnStyle instances (see the
"DataGridTableStyle Class" topic in MSDN for detailed information).
2. Set the Format property on the corresponding DataGridColumnStyle to the
appropriate value (most likely "f", "F", "g" or "G"). See the "Standard
DateTime Format Strings" topic in MSDN for more information.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:lj******************@news20.bellglobal.com...
Hi all,

I've got a DataTable that has a datetime column that is bound to a datagrid. The Datetime Column holds both Date *and* time, but my Datagrid only shows
the date. How would I go about getting it to display both Date *and* time?
regards,

Marco


Nov 15 '05 #2
Thanks,

Much appreciated.

Marco
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi Marco,

1. Configure the grid with a programmatically created DataGridTableStyle
pre-populated with DataGridColumnStyle instances (see the
"DataGridTableStyle Class" topic in MSDN for detailed information).
2. Set the Format property on the corresponding DataGridColumnStyle to the
appropriate value (most likely "f", "F", "g" or "G"). See the "Standard
DateTime Format Strings" topic in MSDN for more information.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:lj******************@news20.bellglobal.com...
Hi all,

I've got a DataTable that has a datetime column that is bound to a

datagrid.
The Datetime Column holds both Date *and* time, but my Datagrid only shows the date. How would I go about getting it to display both Date *and*

time?

regards,

Marco

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gilles T. | last post by:
How I can get element ID in the edit mode of datagrid control? If I not in the edit mode, there are no problem. <asp:TemplateColumn ItemStyle-CssClass="grid_column_width_3"...
2
by: Marcos Rodríguez | last post by:
Hi all I have an Access Data Base containing a table which have a DateTime Field. I am creating a Windows App and I am using a DataGrid object to show data from the table using a DataSet object. My...
2
by: A Programmer | last post by:
I can't believe I have never run into this before but, I have an object that has a property of type DateTime. A collection of these objects are used to populate my DataGrid. In DateTime format they...
1
by: Soul | last post by:
*** I am not sure this question belong to *.languages.csharp or *.framework.windowsdorms.databinding, so I post to both *** Hi, Currently I have a DataGrid which bind to a DataSet. One of...
3
by: Jim H | last post by:
I have a DataGrid where the DataSource is a DataTable that has a DateTime column. Right now it only shows the Date, I want the date and time down to the seconds or better. How do I set the...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
3
by: Paul Say | last post by:
I have a class called Job, that has several properties JobID,Description & StartDate. The StartDate is Property is defined as follows public Class Job private _StartDate as DateTime public...
0
by: Chia Lee Lee | last post by:
Hi, I try to bind records into datagrid based on certain condition.The condition is when the Rdate in database column is larger than today date will be display on datagrid. my problem is , the...
1
mafaisal
by: mafaisal | last post by:
Hello Experts I am Using vb.net 2005 Hw To Put DateTime Picker in Datagrid view I have to sea Datetime Picker in Specified Cilomn of Datagrid I try This But The Location Hw To Change to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.