473,382 Members | 1,639 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,382 software developers and data experts.

DataGrid Column Format

I have a query that gets a string column containing a date, ex. 20040825.
If I use the property builder to format the string to 08/25/2004 it does not
work because it only accepts datetime columns. How can I convert or format
the string. Could I add a new dataset/datatable column containing the value
as I need it.

Thanks.
Nov 16 '05 #1
3 9936
Daniel,

Yes, you could add a new column that has the value in a DateTime format.
The thing is, you would have to be responsible for populating this column,
and keeping it up to date as your data chances.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel M." <dm*****@hotmail.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...
I have a query that gets a string column containing a date, ex. 20040825.
If I use the property builder to format the string to 08/25/2004 it does
not
work because it only accepts datetime columns. How can I convert or
format
the string. Could I add a new dataset/datatable column containing the
value
as I need it.

Thanks.

Nov 16 '05 #2
Nicholas, I am not populating any column, I have the grid bound to a
dataset. Now, it is just for reporting purposes.

Can you send me an example of how to add a new column formatted as a date
from a string column stored in the datatable.

Thanks

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Ob**************@TK2MSFTNGP11.phx.gbl...
Daniel,

Yes, you could add a new column that has the value in a DateTime format. The thing is, you would have to be responsible for populating this column,
and keeping it up to date as your data chances.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel M." <dm*****@hotmail.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...
I have a query that gets a string column containing a date, ex. 20040825.
If I use the property builder to format the string to 08/25/2004 it does
not
work because it only accepts datetime columns. How can I convert or
format
the string. Could I add a new dataset/datatable column containing the
value
as I need it.

Thanks.


Nov 16 '05 #3
Daniel,

It's as easy as calling Add on the object exposed by the Columns
property on a DataTable. Once you do that, you will have to cycle through
all the rows, converting the string value to a DateTime. You ^might^ be
able to have the column to the parsing yourself, but I am not sure that this
is possible, as I don't know if you can set the format in the Expression
property.

I would check the Expression property to determine if there is a
conversion that lets you specify the format.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel M." <dm*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Nicholas, I am not populating any column, I have the grid bound to a
dataset. Now, it is just for reporting purposes.

Can you send me an example of how to add a new column formatted as a date
from a string column stored in the datatable.

Thanks

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:Ob**************@TK2MSFTNGP11.phx.gbl...
Daniel,

Yes, you could add a new column that has the value in a DateTime

format.
The thing is, you would have to be responsible for populating this
column,
and keeping it up to date as your data chances.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel M." <dm*****@hotmail.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...
>I have a query that gets a string column containing a date, ex.
>20040825.
> If I use the property builder to format the string to 08/25/2004 it
> does
> not
> work because it only accepts datetime columns. How can I convert or
> format
> the string. Could I add a new dataset/datatable column containing the
> value
> as I need it.
>
> Thanks.
>
>



Nov 16 '05 #4

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

Similar topics

1
by: J.B | last post by:
I have a datagrid that will display different datasets, (it runs different sprocs based on a value in the querystring) but it will always return 6 columns. The 5th and 6th columns are always Date...
4
by: yer darn tootin | last post by:
Does anyone know the sort expression for a column that's data has been returned in the format, eg '07 Jul 05'?? The sort expression {..:"dd mmm yy"} doesn't work ( if the column was returned as...
5
by: cwbp17 | last post by:
Hi all, Have a datagrid that displays the price column of a table. Went to the Datagrid's Property builder and set the 'Data Formatting expression' for the PRICE column to {0:c}, so that the...
14
by: Brett Sinclair | last post by:
Hello everybody I'm still on the learning curve here...and from what I read, I created inherited datagrid class so I could have icons, combobox...etc in the columns of my datagrid. The grid...
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
8
by: Scott Meddows | last post by:
I have a datagrid control that I've inherited from the base datagrid control (Source below). I am applying a datatable style onto the datatable that I assign as my datasource. All of my column...
6
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is...
13
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for...
2
by: Javier | last post by:
Hi Everyone, I have a dynamic checkbox in a datagrid that uses the ITemplate interface and has the checkchanged event wired up. When the checkbox is checked, the event event handler that...
3
by: Horselover Fat | last post by:
Hi, I have a column in a database that holds elapsed time in milliseconds and I want to display that column in a DataGrid in a specific format (d.hh:mm:ss.fff). However, the closest I can get...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.