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

How to retrieve date values into dropdownlists

5
Hi,
Please help me out in this task.

I have a filed in the database of datetime. and 3 dropdown lists in the page.
Im using Asp.net with VB coding. The three dropdown lists are
1.for date
2.for month
3.for year
the value selected is to be placed in the db and after that to be retrieved to the page with selected values.

Im able to save the selectedvalues in the db in format mm/dd/yyyy. but unable to retrieve that values to the drop down lists.
i used data reader to read the values from the db.
i tried the ways like

ddldate.selecteditem.text=day(cdate(dr.item("dob") )).to string

all the ways with this.
but could not get the value.

please help me out to retrieve the values.


Thanks in Advance.
Micela.
Sep 16 '06 #1
2 2323
aplus
14
Hi,
Please help me out in this task.

I have a filed in the database of datetime. and 3 dropdown lists in the page.
Im using Asp.net with VB coding. The three dropdown lists are
1.for date
2.for month
3.for year
the value selected is to be placed in the db and after that to be retrieved to the page with selected values.

Im able to save the selectedvalues in the db in format mm/dd/yyyy. but unable to retrieve that values to the drop down lists.
i used data reader to read the values from the db.
i tried the ways like

ddldate.selecteditem.text=day(cdate(dr.item("dob") )).to string

all the ways with this.
but could not get the value.

please help me out to retrieve the values.


Thanks in Advance.
Micela.

Hi..

//to Get Day
ddlDay.SelectedValue = Convert.ToDateTime(dr.item("dob")).Day

//to Get Month
ddlMonth.SelectedValue = Convert.ToDateTime(dr.item("dob")).Month

//to Get Year
ddlYear.SelectedValue = Convert.ToDateTime(dr.item("dob")).Year

- Ankit
Sep 16 '06 #2
Micela
5
thank you Ankit it worked out


Hi..

//to Get Day
ddlDay.SelectedValue = Convert.ToDateTime(dr.item("dob")).Day

//to Get Month
ddlMonth.SelectedValue = Convert.ToDateTime(dr.item("dob")).Month

//to Get Year
ddlYear.SelectedValue = Convert.ToDateTime(dr.item("dob")).Year

- Ankit
Sep 18 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Cheryl | last post by:
Hi, I have encounter a problem.Language use is C#. I would like to open a new window (is a modal window, where I m not able to switch from parent window after this window is open)from the parent...
2
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
8
by: MattB | last post by:
I have a asp.net 1.1/vb application that has a page with a bunch of dynamically added User Controls. When I add the controls, I set the UserControl.EnableViewState to true. For all my controls...
3
by: Rajani | last post by:
Hello, I replaced the calendar control to 3 dropdownlists(day,month and year) coz i want to display the calendar as just like DTPicker in vb.6. But i cant able to display like that. The form...
1
maxamis4
by: maxamis4 | last post by:
Hello folks, Here is the backgroup. I am creating an agent that can find a user in LDAP and return the last logon date. Now i am not sure if with active directory you can user the...
2
by: John | last post by:
I am having trouble getting this code to work, and was wondering if someone could tell me what I am doing wrong. -------------------------------------- CODE--------------------------------------...
0
by: Nathan Sokalski | last post by:
I have a custom control that inherits CompositeControl implements IPostBackDataHandler and ICallbackEventHandler. In the LoadPostData function, I attempt to use the PostCollection parameter to get...
0
by: Nathan Sokalski | last post by:
I have a custom control that inherits CompositeControl implements IPostBackDataHandler and ICallbackEventHandler. In the LoadPostData function, I attempt to use the postCollection parameter to get...
2
by: asmasm1 | last post by:
hi i have had a form in which 10-20 dropdownlists r present and it was working nice the values of these dropdownlists r derived from dbase now when i am saving values of dropdownlists the value...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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

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.