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

how to format datetime in dropdownlist control

Hi expart,
I have facing the problem of formatting the datetime in Dropdownlist.
I am using Data Reader to retrive the date data from Sql2000 server
and bind to DropDownList Control.
The default format showing in the DropDownList is "MM/dd/yyyy".
I want to change the format to "dd/MM/yyyy".
The code sample as below.

sqlconn.open()
dim sqlcomm as sqlclient.sqlcommand
sqlcomm.commandtext = "select testdate from testtable"
sqlcomm.commandtype= commandtype.text
sqlcomm.connection= sqlconn
dim sqldareader as sqlclient.sqldatareader
sqldareader = sqlcomm.executereader

testdropdownlist.datasource=sqldareader
testdropdownlist.databind

anyone can help me how to program to change testdropdownlist datetime format.
--
BR,
Oscar
Nov 21 '05 #1
1 9449
Hi

It seems that you are using the DropDownList on WebForm.
We can use the DataTextFormatString property to do the formatting.
e.g.
dropdownlist1.DataTextFormatString ="{0:dd/MM/yyyy}"

ListControl.DataTextFormatString Property
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwebuiwebcontrolslistcontrolclassdatatex tformatstringtopic.asp

DateTimeFormatInfo Class
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemglobalizationdatetimeformatinfoclasstop ic.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2

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

Similar topics

4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
2
by: Ali | last post by:
I am adding a DropDownList control to my DataGrid footer template. I load my DropDownList using a function that returns an arrayList. I can see all my items in the DropDownList, but when I select...
3
by: william | last post by:
Hi, I have a dropdownlist control and a few textbox on my web form. How can I update those textbox content when user select item from dropdownlist control? I really want to do this on client...
1
by: Matt | last post by:
Hi. I'm using VS2005 and working with the Dropdownlist control on an ASP page. My dropdownlist has several thousand items, all integers, ranging from 1000 to 80000 (these represent different...
2
by: glenn | last post by:
Hi folks, I am trying to determine which item in a DropDownList Web control has been selected. I have posted an OnSelectedIndexChanged subroutine in my code with a reference to the subroutine...
2
by: jack | last post by:
Hi all im trying to use DropDownList control in GridView The senerio is like the <ItemTemplateControl is a Label control and when click on edit control DropDownList should be the...
7
by: =?Utf-8?B?UmVraGE=?= | last post by:
Hi, I am trying to change the font color for the items in a dropdownlist control at run time using ASP.NET 2.0. DropDownList1.Items.Attributes.Add("style", "color:red"); But when I run the...
0
by: henrychong | last post by:
Can someone help me. I want to find a dropdownlist control in a datagrid (named dgDestinations) and i want to make the dropdownlist visible in Page_load. How can i access the control in Page_load?...
2
by: Aswanth | last post by:
Hi.. I'm using Asp.Net with C#.... I'm having One Dropdownlist control(Users_Details_DDL) in Default.aspx Page... i'm having one Stored Procedure (Get_User_Email) which will display the Data...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.