473,395 Members | 1,578 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,395 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 3815
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
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
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.