custom layout : RadioButtonList

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default custom layout : RadioButtonList

    Hi!

    I'm wondering how I can add extra html to a radiobuttonList, so that I can
    control how:
    -the whole radioButtonList is rendered.
    -each of the radiobutton elements are rendered.

    What I am basically trying to do is to combine x radioButtonlists, so that
    the output will look like this:
    ----------------------------------------------------------------------------
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>True</td>
    <td>False</td>
    <td>Don't know</td>
    <td></td>
    </tr>
    <tr>
    <td><input id="question_4_0_0" type="radio" value="9"
    name="question_4_0"></td>
    <td><input id="question_4_0_1" type="radio" value="10"
    name="question_4_0"></td>
    <td><input id="question_4_0_2" type="radio" value="-"
    name="question_4_0"></td>
    <td>&nbsp;Answer 1</td>
    </tr>
    <tr>
    <td><input id="question_4_1_0" type="radio" value="1"
    name="question_4_1"></td>
    <td><input id="question_4_1_1" type="radio" value="2"
    name="question_4_1"></td>
    <td><input id="question_4_1_2" type="radio" value="-"
    name="question_4_1"></td>
    <td>&nbsp;Answer 2</td>
    </tr>
    <tr>
    <td><input id="question_4_2_0" type="radio" value="1"
    name="question_4_2"></td>
    <td><input id="question_4_2_1" type="radio" value="2"
    name="question_4_2"></td>
    <td><input id="question_4_2_2" type="radio" value="-"
    name="question_4_2"></td>
    <td>&nbsp;Answer 3</td>
    </tr>
    </table>
    ----------------------------------------------------------------------------

    The radiobuttonlists are dynamically created, using data from a database.
    My idea was to add the <table> start and end tags manually as I am looping
    through the database.

    What I need though, is a way to :
    -add <tr> start and end tags for each radioButtonlist
    -add <td> start and end tags for each radioButton within each
    radioButtonlist.

    I imagine that there is a method I can override, that deals with the
    creation of the radiobuttonlist, and that there also is a method I can
    override, that creates the child elements (each radiobutton) within the
    radiobuttonlist.

    If anyone knows what methods I need to override, and how I do this, I would
    really appreciate it.


    Christian H Guest

  2. Similar Questions and Discussions

    1. Adding layout elements within custom control
      Hi all, I have a custom control that I use within forms that contains form inputs and validator controls. At the moment I'm overriding the Render...
    2. Custom RadioButtonList and modifying HTML?
      The HTML generated by the RadioButtonList contains a table structure as: <table id="rbList1" border="0"> <tr>...
    3. RadioButtonList
      Maybe you can help me with the following logic I am trying to accomplish. My RadioButtonList is in datagrid <EditItemTemplate> column If my...
    4. Custom RadioButtonList with Attribute support for ListItem
      I found the listitem class was sealed, and can't get tooltips for radio button in a radionbuttonlist, apparently this is by design.. ...
    5. Radiobuttonlist and cssclass
      I am in the process of updating old asp projects into asp.net. We used to have radiobuttons which had an attached css class as follows: <label...
  3. #2

    Default Re: custom layout : RadioButtonList

    Hi,

    The easy way is to use the DataList Control (template with label and
    radioButtonList). You can also create your own RadioButtonList control
    that derived from RadioButtonList and override the Render method.

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139