populating radiobuttonlist from database programmatically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hazzard

    #1

    populating radiobuttonlist from database programmatically

    I store radiobuttonlist values in the db using the string value of the radio
    button item value. (nvarchar)

    I am creating an edit functionality on the asp.net form so that when I reuse
    my dataentry form for edit, I search the database for the row containing the
    data I want, and then populate all the form fields.

    here is what I have so far. What I don't know what to do is for cases where
    a dirty database has no associated value for the radiobuttonlist , I don't
    want to select anything. How do I do that?
    ***************
    dbaseReturnValu e = arParms(17).Val ue.ToString() 'get value from returned
    stored procedure call.
    For Each li In RadioButtonList .Items
    i += 1
    If (RadioButtonLis t.Value = dbaseReturnValu e Then //but Value is
    not a valid member. what do i use?
    RadioButtonList .SelectedValue = dbaseReturnValu e
    li.Selected = True
    else
    RadioButtonList .SelectedValue = ???????????
    End If
    Next
    ***************
    Thank you,
    Greg Hazzard


Working...