Adding Attributes to RadioButtonList Control

Discussion in 'ASP .Net' started by djarmoluk@gmail.com, Jan 22, 2006.

  1. Guest

    I have a RadioButtonList (named rbAnswers) control within a repeater
    control. When binding to the repeater, I am trying to add an "OnChange"
    attribute to the individual list item controls (input controls of type
    radio) using the following syntax:

    For Each Item In rbAnswers.Items
    Item.Attributes.Add("OnChange", MethodName)
    Item.Enabled = False
    Next

    If I debug through the ItemDataBound event, "Item" is in fact a
    ListItem control that represents a radio button within the rbAnswers
    RadioButtonList control. However, the OnChange attribute I add is
    placed in a <SPAN> tag before the <INPUT type=Radio> control thus
    preventing my OnChange method from ever being called. Somehow, I need
    to figure out how to get the OnChange attribute into the <INPUT>
    control. Any ideas? What is strange about this is that the <INPUT>
    control is disabled as desired (Item.Enabled = False).

    To give some more background if it helps, I am creating an assessment
    of about 40 questions generated from questions/answers in a database.
    The assessment questions have dependencies such that the answer to one
    question can disable/enable another question. I am creating the client
    side javascript dynamically to do this. Changing an assessment response
    should call the javascript which will then enable/disable a different
    question.
    , Jan 22, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike S
    Replies:
    1
    Views:
    1,067
    Mike S
    Jul 15, 2003
  2. ani
    Replies:
    0
    Views:
    454
  3. psb
    Replies:
    2
    Views:
    17,014
    Achintya Jha
    Sep 22, 2004
  4. raz
    Replies:
    0
    Views:
    359
  5. raz
    Replies:
    0
    Views:
    377
Loading...

Share This Page