DataTextFormatString property

B

bazzer

i have a webform accessing a microsoft access database. when i display
dates i get from a table, into a listbox, their displayed in the form:
"05/04/2006 00:00:00". all i want to be displayed is the date alone.
what would i need to put in the DataTextFormatString property in my
listbox properties window to achieve this?

and is there a way to display the day, e.g. "Wednesday 05/04/2006"
before each item in the listbox even though its not stored in my access
database?

thanks,
bazzer.
 
G

Guest

There is no aplicable DataTextFormatString value for formatting dates. You
can display the day of the week by putting the value from the date field into
an object of type System.DataTime and then retrieving the DayOfWeek property.
You could also populate the textbox with just the date by using the
ToShortDateString method of the same object.
 
B

bazzer

thanks for thoses links. checked em out but not sure exactly what im
supposed to do. tryed puttin just d and also ddmmyyyy in the
DataTextFormatString but all i get then in the listbox is those exact
letters?
 
B

bazzer

i just tried that aswell but i get the error:

"Input string was not in a correct format."

from the line:
ListBox1.DataBind()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top