p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

aspdotnet_website_programming thread: datagrid column formating..


Message #1 by "Stas" <stas@z...> on Fri, 24 May 2002 17:21:05 +0300
This is a multi-part message in MIME format.

------=_NextPart_000_0003_01C20347.62E80790
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

 
 
Hi guys!
 
I have a question. 2 columns in my datagrid show dates from dataset and
show them like that: 24.05.2002 0:00:00
But I would like to see them in format 24.05.2002 (without time, only
date). I noticed datagrid column has a property "Text format string".
Does anybody knows do I need to use it? Or is there another way?
 
 
Thanx in advance,
Stas
 
 
 


Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Fri, 24 May 2002 10:47:25 -0400
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C20331.EB314230
Content-Type: text/plain

Stas,
 
    Although I haven't actually used this yet, alot of stuff in .NET let you
format the results (in fact, alot of .ToString() methods are overloaded to
accept a format string).  You could try:
 
row["date"].ToString("dd.MM.yyyy");
 
or any derivitive there of.  I did not find a "TextFormatString" property of
DataGridColumn, but I did find a "Format" property of
"DataGridTextBoxColumn".  I would guess that you could do:
 
yourTextBoxColumn.Format = "dd.MM.yyyy";
 
HTH,
- Chuck
 
 
-----Original Message-----
From: Stas [mailto:stas@z...]
Sent: Friday, May 24, 2002 10:21 AM
To: Website Programming with ASP.NET
Subject: [aspdotnet_website_programming] datagrid column formating..


 
 
Hi guys!
 
I have a question... 2 columns in my datagrid show dates from dataset and
show them like that: 24.05.2002 0:00:00
But I would like to see them in format 24.05.2002 (without time, only date).
I noticed datagrid column has a property "Text format string". Does anybody
knows do I need to use it? Or is there another way?
 
 
Thanx in advance,
Stas
 
 
 
--- 

Message #3 by "Minh T. Nguyen" <nguyentriminh@y...> on Fri, 24 May 2002 09:00:11 -0700
Stas,

    It's actually the DataFormatString attribute that you set to
"{0:SomeFormatString}" where 0 means that you are referring to the first
variable (well, there is only one for one column), then use Date Format
strings
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
tml/frlrfsystemglobalizationdatetimeformatinfoclasstopic.asp.


Hope this helps,
Minh.

-----Original Message-----
From: Stas [mailto:stas@z...] 
Sent: Friday, May 24, 2002 7:21 AM
To: Website Programming with ASP.NET
Subject: [aspdotnet_website_programming] datagrid column formating..


 
 
Hi guys!
 
I have a question. 2 columns in my datagrid show dates from dataset and
show them like that: 24.05.2002 0:00:00
But I would like to see them in format 24.05.2002 (without time, only
date). I noticed datagrid column has a property "Text format string".
Does anybody knows do I need to use it? Or is there another way?
 
 
Thanx in advance,
Stas
 
 
 
--- 

Message #4 by "Stas" <stas@z...> on Fri, 24 May 2002 19:18:09 +0300
Thanx for your replies, I found a solution using dataBinder object and
datagrid item templates...

Stas


-----Original Message-----
From: Minh T. Nguyen [mailto:nguyentriminh@y...] 
Sent: Friday, May 24, 2002 7:00 PM
To: Website Programming with ASP.NET
Subject: [aspdotnet_website_programming] RE: datagrid column formating..

Stas,

    It's actually the DataFormatString attribute that you set to
"{0:SomeFormatString}" where 0 means that you are referring to the first
variable (well, there is only one for one column), then use Date Format
strings
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
tml/frlrfsystemglobalizationdatetimeformatinfoclasstopic.asp.


Hope this helps,
Minh.

-----Original Message-----
From: Stas [mailto:stas@z...] 
Sent: Friday, May 24, 2002 7:21 AM
To: Website Programming with ASP.NET
Subject: [aspdotnet_website_programming] datagrid column formating..


 
 
Hi guys!
 
I have a question. 2 columns in my datagrid show dates from dataset and
show them like that: 24.05.2002 0:00:00
But I would like to see them in format 24.05.2002 (without time, only
date). I noticed datagrid column has a property "Text format string".
Does anybody knows do I need to use it? Or is there another way?
 
 
Thanx in advance,
Stas
 
 
 
--- 




  Return to Index