0

I have a radiobutton list (With 2 rdb) and a check list (7 ckb). I would like the checkbox list appears only when the user selects the second radio button is checked.

I never used AJAX before.

My actual code (yes, they are inside a table):

<td>

                    <asp:Label ID="Label7" runat="server" Font-Bold="True">Frequency</asp:Label>
                    <table>
                        <tr>
                            <td>
                                <asp:RadioButtonList ID="rdbDaysList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="rdbDaysList_SelectedIndexChanged"
                                    RepeatColumns="2" CausesValidation="True">
                                    <asp:ListItem>Daily</asp:ListItem>
                                    <asp:ListItem>Weekly</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                <asp:CheckBoxList ID="ckbList" runat="server" Visible="false" RepeatColumns="5" RepeatDirection="Horizontal">
                                    <asp:ListItem>Monday</asp:ListItem>
                                    <asp:ListItem>Tuesday</asp:ListItem>
                                    <asp:ListItem>Wednesday</asp:ListItem>
                                    <asp:ListItem>Thursday</asp:ListItem>
                                    <asp:ListItem>Friday</asp:ListItem>
                                    <asp:ListItem>Saturday</asp:ListItem>
                                    <asp:ListItem>Sunday</asp:ListItem>
                                </asp:CheckBoxList>
                            </td>
                        </tr>
                    </table>
</td>

Thanks in advance!

2 Answers 2

2

make sure the RadioButtonList autoPostback = true

1

You'll need to surround the radion button and check box list with an UpdatePanel control. Then in the OnSelectIndexChanged event on the radio button control, set the Visible property of then check box list to true.

4
  • It not worked. Should I trigger the updatepanel with the radiobutton in some way besides the event? Jul 16, 2010 at 19:46
  • If you set a break point in the SelectedIndexChanged event does it hit it? If not, there's a problem with the radio button not doing an auto postback. Otherwise the problem is the check box list is not being set to visible properly.
    – d4nt
    Jul 16, 2010 at 20:02
  • Man, everything is in its place and still does not work. My page is inside a Master Page. This should interfere in some way? Jul 20, 2010 at 17:29
  • YES! I putted my ScriptManager in the master page and everuthing worked fine! Thanks for the inspiration! Jul 20, 2010 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.