473,769 Members | 5,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retrieve date values into dropdownlists

5 New Member
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.selecte ditem.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 2333
aplus
14 New Member
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.selecte ditem.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.Selected Value = Convert.ToDateT ime(dr.item("do b")).Day

//to Get Month
ddlMonth.Select edValue = Convert.ToDateT ime(dr.item("do b")).Month

//to Get Year
ddlYear.Selecte dValue = Convert.ToDateT ime(dr.item("do b")).Year

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


Hi..

//to Get Day
ddlDay.Selected Value = Convert.ToDateT ime(dr.item("do b")).Day

//to Get Month
ddlMonth.Select edValue = Convert.ToDateT ime(dr.item("do b")).Month

//to Get Year
ddlYear.Selecte dValue = Convert.ToDateT ime(dr.item("do b")).Year

- Ankit
Sep 18 '06 #3

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

Similar topics

2
12570
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 window , where there are 3 dropdownlists and a "OK" button. Upon clicking the button, this window will close and the select of the dropdownlists will be collect and send back to the parent window. But I am do not know how to do it. Can...
2
5429
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 I want to be able to retrieve the selected value from each of the sets of radio buttons.The names of each group of radio buttons is set by the database and I don't know how to retrieve the values because I don't know the names of these radio...
8
1572
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 with TextBoxes, I can get the value back out of the controls just fine. One of my User Controls has some DropDownLists as well as a TextBox. I get a value from the TextBox on postback, but not the DropDownLists. Even if I see a value selected when...
3
1392
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 ocupies more space. But i am facing another problem. My table structure is staff(empid integer,joindate datetime) i am getting the date selected as
1
4106
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 SAMAccountName to retrieve the last computer the users logged on to. But i am looking for a place where i can learn this information. I was hoping someone out there could point me in the right direction. Below is my code which i have been working on. It can...
2
1677
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-------------------------------------- if (isset($_POST)) { require_once("database.php"); $appt_date = $_POST . '/' . $_POST . '/' . $_POST;
0
918
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 the data posted by the child controls created in CreateChildControls. In the PreRender event, I add onchange attributes to the DropDownLists with a value created using the Page.ClientScript.GetCallbackEventReference. When one of my DropDownLists...
0
1014
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 the data posted by the child controls created in CreateChildControls. In the PreRender event, I add onchange attributes to the DropDownLists with a value created using the Page.ClientScript.GetCallbackEventReference. When one of my DropDownLists...
2
1369
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 gets lost to default. as i'm using ajax &asp.net 2.0.onload event i have place code 4 getting dropdownlist values under if not ispostback condition i fail to solve this plz solve my problem
0
9423
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
10211
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...
1
9994
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
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7409
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
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
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.