Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Format the datetime in GridView

Author  Topic 

sheena
Starting Member

45 Posts

Posted - 2007-04-06 : 14:05:10
On displaying data in the gridview with sqldatasource in asp.net C# 2005 on the datetime datatype field i want to display only the date but it displays the time also on each and every row.

On the money datatype field i want to display the roundoff amount or with decimal upto 2places like 12,000.00 which is shown as 12,000.0000...
I have seen the same question in previous topic also but don't got it so asking in my post...

Pls tell me some format to avoid this invalid data.

Thanxs in advance and waiting for ur response.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-06 : 14:20:29
If you have data-bound grid, you can use DataFormatString property.

Check this link: [url]http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-04-06 : 14:21:11
You can either do it through T-SQL or your front end. I would recommend your front end - VB.NET or C# ..there is probably a DataformatString property if I remember correectly.

************************
Life is short. Enjoy it.
************************
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-07 : 03:13:10
<<
You can either do it through T-SQL or your front end.
>>

I always prefer doing in front end

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -