ASP.net: Radio Button Not Maintaining Selection After Postback, Inside DIV/Thickbox

Posted by jlrolin on Stack Overflow See other posts from Stack Overflow or by jlrolin
Published on 2010-05-24T20:04:35Z Indexed on 2010/05/25 6:01 UTC
Read the original article Hit count: 276

Filed under:

I have a set of radio buttons inside a hidden DIV.

<div  id="reports" style="display:none;">
        <center>
        <br />
            <table cellpadding="4" cellspacing="0">
                <tr>
                    <td class="label">
                        Report Type::&nbsp;
                    </td>
                    <td class="value">
                        <asp:RadioButton ID="rbReportTypeCust" runat="server" Text="By Customer" Enabled="True" Checked="True"  GroupName="rbType" />&nbsp;<asp:RadioButton
                            ID="rbReportTypeProg" runat="server" Text="By Program" Enabled="True"  GroupName="rbType" />
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        Customer:&nbsp;
                    </td>
                    <td class="value">
                        <asp:DropDownList ID="ddlCustomer" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        Program Group::&nbsp;
                    </td>
                    <td class="value">
                        <asp:DropDownList ID="ddlProgramGroups" runat="server" />
                    </td>
                </tr>
            </table>
            <br />
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit"
                        OnClientClick="doPostBack(this);" />
        </center>
        </div>

The DIV is displayed using Thickbox as a modal popup. The doPostback javascript function posts the button click back, and hits btnSubmit_Click where a report is then generated. If I see if a radio button is checked, it's always rbReportTypeCust.checked = True, never the rbReportTypeProg.checked = True even if I click it.

Any suggestions?

© Stack Overflow or respective owner

Related posts about ASP.NET