473,403 Members | 2,071 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,403 software developers and data experts.

Dropdown Listbox date value


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.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #1
4 3817
You can specify the format string using the
DataTextFormatString property i.e. {0:"d"}

Tu-Thach
-----Original Message-----

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

James W. Hall Sr.
*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
.

Jul 21 '05 #2
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.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3
It should be {0:d}. I put in the extra " around the d last time.

Tu-Thach

James W. Hall Sr. <ji*****@alpha-transportation.com> wrote in message news:<#I*************@tk2msftngp13.phx.gbl>...
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.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 21 '05 #4
Thank you for your time. It worked without the " but you did need the
{}.

James W. Hall Sr.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #5

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

Similar topics

10
by: J P Singh | last post by:
Hi There We have dropdown on ASP page. The problem is we have about 900 items in the dropdown. Users scrolling through the list have become very frustrated in the past. Can someone suggest...
6
by: A P | last post by:
Hi! I have seen some techniques like this on the web. Currently, I'm using Combo box which values came from database table. One disadvantage is when the combo box have lots of values, users are...
1
by: seansan | last post by:
Hi, I ahve an issue that I could tackle myself. sometimes a dropdown box is filled with only one element. How can I set this dropdown box to auto-select this one option? So in VB. If my...
4
by: Paul | last post by:
I have a dropdown list box and a button on a web form, the autopost back is false for the dropdown list box and button. When the button is pushed the selection in the dropdownlist box is lost,...
0
by: KC | last post by:
How can you capture an event from the dropdown calendar in a DateTimePicker? I want the date the user picks to be added to a listbox, but the only way I can think to do that now it to check the...
4
by: James W. Hall Sr. | last post by:
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...
1
by: acord | last post by:
Hi, I am having problem to get a value of the selected item from a dropdown listbox. Here is the JS function; function getSelectedItem(objSelect) { alert("in getSelectedItem"); alert...
1
by: servernet1997 | last post by:
I have a gridview with 4 columns. Two of the columns are read-only and two are editable. The two editable columns are listboxes leveraging an ObjectDataSource. The first listbox is populated from a...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.