473,758 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3865
You can specify the format string using the
DataTextFormatS tring 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 datatextformats tring 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*****@alph a-transportation. com> wrote in message news:<#I******* ******@tk2msftn gp13.phx.gbl>.. .
I tried using the datatextformats tring 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
5252
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 if there is another way of implement a dropdown where the datalist is as big as ours. I am looking for something like a listbox in VB where you can start typing
6
2720
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 complaining since you cannot use keyboard to search the value that is needed. Hope you might help me. regards, Me
1
2138
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 listcount of a dropdown element is 1 how do I capture the value of this element and set the dropdown box to show/select this one element? (instead of showing empty)
4
4594
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, just wondering what is wrong. Selected value is always 1 no matter what is selected in the dropdown list box. Private Sub btn_yes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_yes.Click Dim s_origidval As String
0
1124
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 ValueChanged event in the DateTimePicker. Problem with that is if the user chooses a new month the value displayed changes which causes that date to be added to the list. I only want that to happen if the user chooses a date.
4
346
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 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.
1
25732
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 (objSelect.length); alert (objSelect.value);
1
1306
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 table of static information, the second listbox is more problematic. If the contents of the first listbox contains one specific value, I want to populate the second listbox with the results of QueryA when the row is edited. If the contents of...
4
4586
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 reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
0
9492
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9299
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10076
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9908
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8744
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5332
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3832
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.