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

DataTextFormatString property

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.

Apr 5 '06 #1
7 6985
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.

"bazzer" wrote:
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.

Apr 5 '06 #2
There are a number of preexisting formats, and you always have the ability
to create your own.

You can find the existing formats here:
http://msdn.microsoft.com/library/de...matstrings.asp

Or you can use a custom format for greater control:
http://msdn.microsoft.com/library/de...matstrings.asp

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"bazzer" <so*******@yahoo.com> wrote in message
news:11*********************@i39g2000cwa.googlegro ups.com...
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.

Apr 5 '06 #3
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?

Apr 5 '06 #4
try {d} I think

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"bazzer" <so*******@yahoo.com> wrote in message
news:11**********************@t31g2000cwb.googlegr oups.com...
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?

Apr 5 '06 #5
i just tried that aswell but i get the error:

"Input string was not in a correct format."

from the line:
ListBox1.DataBind()

Apr 6 '06 #6
fixed it.

{0:d} works.

thank Karl.

Apr 6 '06 #7
{0:d} and you have to turn off html formatting for the column.

Apr 6 '06 #8

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

Similar topics

0
by: Joe Abou Jaoude | last post by:
hi, I want to populate a dropdownlist from an array of integers of two digit maximum. suppose we have these numbers 1, 2 , 15 ,.... i want the numbers to be displayed in this format:...
3
by: Johnny M | last post by:
using Access 2003 Pardon the subject line, but I don't have a better word for this strange behavior (or behavior I don't understand!!!) I have a class module named DepreciationFactor. One of...
7
by: MP | last post by:
Hello, I am trying to write a class that will expose some properties. One of the property is extracted from a SQL database and can be NULL or some integer value. Is there a elegant way of...
3
by: McNutt Consulting | last post by:
I'm trying to implement a datagrid with dynamically created columns. The data is coming out of a very simple XML file, and it's bound through a dataview. The datagrid is just a shell definition...
1
by: Xerox | last post by:
I want to display items in a list control using DataTextFormatString to format them. The list control is bound to an array of Person objects. I want to format each item as "LASTNAME, Firstname". So...
0
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
15
by: Lauren Wilson | last post by:
Owning your ideas: An essential tool for freedom By Daniel Son Thinking about going into business? Have an idea that you think will change the world? What if you were told that there was no way...
2
by: james | last post by:
Does anyone know how to use the String.Replace in CheckBoxList.DataTextFormatString ? I tried: {0}.Replace(" ", "&nbsp;") but that obviously doesnt work. Any Ideas? Thanks! James
1
by: cday119 | last post by:
I have a Class with about 10 properties. All properties return right except for one. It is real annoying and I can't see why its not working. Maybe someone else can see something. It is the...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.