Dropdown Listbox date value

  • Thread starter Thread starter James W. Hall Sr.
  • Start date Start date
J

James W. Hall Sr.

I am filling a dropdown listbox in ASP.NET. The display value is a date
field from SQL Server. When I bind the data to the dropdown listbox the
time appears in with the data (12:00 am). In the database it appear
12/31/2003. It appears in the control as 12/31/2003 12:00 am. I am
trying to format the field in the select statement with no luck. Can
anyone help me?

James W. Hall Sr.
 
You can specify the format string using the
DataTextFormatString property i.e. {0:"d"}

Tu-Thach
 
I tried using the datatextformatstring as you stated. I get an error
converting string to date when I selectvalue. Do you have any
suggestions? The display value is the date the value is weekid, which
is integer.

James W. Hall Sr.
 
It should be {0:d}. I put in the extra " around the d last time.

Tu-Thach
 
Thank you for your time. It worked without the " but you did need the
{}.

James W. Hall Sr.
 

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

Back
Top