Results 1 to 6 of 6

Thread: problems with radio button list and drop down list (not combo)

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2003
    Posts
    38

    problems with radio button list and drop down list (not combo)

    i am facing a few problem...
    first i have a dropdown list
    next i have a radio button list

    now the question is how i arrange the items in the drop down list in alphabetical order?

    another question is how i store the value for radion button list in a session object?

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    where do you get the items from in your drop down list?
    If you get them from a database then you can sort them alphabetically as part of the SQL statement.
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You should ask this in the ASP.NET section.

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2003
    Posts
    38
    but i am using VB in the codes
    here are the codes i typed...
    cheer!
    thanks for helping me...


    Dim ds As DataSet
    ds = New DataSet()
    MyDataProvider.Fill(ds, "c:\inetpub\wwwroot\quicknames\AtoZ.mdb", "AtoZ")

    Dim strAdd As String
    Dim i As Integer
    Dim j As Integer
    Dim bAdd As Boolean
    For i = 0 To ds.Tables(0).Rows.Count - 1

    strAdd = ds.Tables(0).Rows(i)(3)

    'check if list already contain strAdd
    bAdd = True
    For j = 0 To DropDownList2.Items.Count - 1
    If (DropDownList2.Items(j).Text = strAdd) Then
    bAdd = False
    Exit For
    End If
    Next

    If (bAdd = True) Then
    DropDownList2.Items.Add(strAdd)
    End If

    Next

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2003
    Posts
    38
    Can any one help me?
    i am still stuck...
    and my project is going to due soon..

  6. #6
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310
    Well, as was said earlier, you could set the sorted property to true for the combo OR you could re-write the SQL statement to get the data sorted using the ORDER BY statement.

    As for the radio button stored in the session object, you could do

    VB Code:
    1. Session("RadioButton") = RadioButton.SelectedIndex

    This assumes you use a RadioButtonList for your radio buttons.

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