|
-
Mar 22nd, 2004, 08:56 PM
#1
Thread Starter
Member
dropdownlist
Hi,
Im thinking of trying to display the information (one of the DOB year e.g: 1988) from the database into the dropdownlist and wish to display all the DOB year details for the user to update it. Can this be done?
E.g: Date Of birth year: from 1960 - 1990 where the user date of birth year is 1988. I want it to capture the year 1988 from the database can be displayed and also other DOB year from 1960 - 1990. I hope you guys can understand what i mean. Hope to have an idea of how to go about doing it and would really appreciate if samples were given. Thank you in advance.
-
Mar 23rd, 2004, 05:05 AM
#2
I think i get what you mean. Sorry i haven't checked this.
VB Code:
Dim i As Short
For i = 1960 To 1990
cboDOB.Items.Add(i)
Next
'strDOB is the DOB from the database
cboDOB.Items.FindByText(strDOB).Selected = True
That should give you a dropdownlist containing 1960 - 1990 with the date stored in strDOB (1988 in this case) selected.
Last edited by Fishcake; Mar 23rd, 2004 at 05:09 AM.
-
Mar 24th, 2004, 07:46 PM
#3
Thread Starter
Member
thank you fishcake!
I manage to do it by retrieving numbers. But i can't do it by using string or words.
codes i use by using numbers:
Dim dgItem As DataGridItem
For Each dgItem In dgSlotDate.Items
Dim i As Short
For i = 1 To 7
CType(dgItem.FindControl("ddlDay"), DropDownList).Items.Add(i)
Next
Dim strDay = Session("Search")
'strDay is the SlotDateID from the database
CType(dgItem.FindControl("ddlDay"), DropDownList).Items.FindByText(strDay).Selected = True
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|