Results 1 to 3 of 3

Thread: dropdownlist

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2004
    Posts
    47

    Exclamation 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.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    I think i get what you mean. Sorry i haven't checked this.

    VB Code:
    1. Dim i As Short
    2.         For i = 1960 To 1990
    3.             cboDOB.Items.Add(i)
    4.         Next
    5.  
    6.         'strDOB is the DOB from the database
    7.         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.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2004
    Posts
    47
    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
  •  



Click Here to Expand Forum to Full Width