0

Hello I have this table with 2 radio buttons to answer a yes or no question. If neither buttion is clicked when the page is submitted, I would like some type of message box to pop up telling the user they have to make a choice before they can go to the next page. What is the best way to do that? I'm not sure if I should use some type of vb validation or just a pop up box or something. Here is the table with the 2 radio buttons.

<table style="width:100%;">
        <tr>
            <td class="auto-style2">
                <asp:RadioButton ID="RadioButton1" GroupName="rreview" runat="server" Text="Yes, I agree to participate" />
            </td>
        </tr>
        <tr>
            <td class="auto-style2">
                <strong>OR</strong></td>
        </tr>
        <tr>
            <td class="auto-style2">
                <asp:RadioButton ID="RadioButton2" GroupName="rreview" runat="server" Text="No, I choose not to participate" />
            </td>
        </tr>
    </table>
2
Contributors
7
Replies
15
Views
3 Years
Discussion Span
Last Post by JorgeM
0

Hello JorgeM. Thanks for the response. The reason I didn't use a <asp:RadioButtonList /> was because I wasn't able to add the text the way I needed to look. Here is how it has to look for my form. Can I still do this with a radiobutton list? Also, as you see there are 2 sets of 2 radio buttons. But in each set only 1 of the 2 buttons can be chosen. Also, 1 of the buttons in each list much be chosen to move no to the next section of the form. I hope I am explaining this clear enough.

<em>CHECK √ ONE Statement in the box below</em>.<br />
    <h3>Part #1 - RECORDS REVIEW</h3>
      <asp:Label ID="Label1" runat="server" Text="Please choose Yes or No" Visible="false"></asp:Label>
    <table style="width:100%;">
        <tr>
            <td class="auto-style2">
                <asp:RadioButton ID="RadioButton1" GroupName="rreview" runat="server" Text="Yes, I agree to participate.  " />
            </td>
        </tr>
        <tr>
            <td class="auto-style2">
                <strong>OR</strong></td>
        </tr>
        <tr>
            <td class="auto-style2">
                <asp:RadioButton ID="RadioButton2" GroupName="rreview" runat="server" Text="No, I choose not to participate." />
            </td>
        </tr>
    </table>
    <br />
    AND<br />
    <br />
    <em>CHECK√ ONE statement in the box below</em> to show whether you want to be in the Research Registry.<br />
    <h3>Part #2  -  RESEARCH REGISTRY</h3>
      <asp:Label ID="Label2" runat="server" Text="Please choose Yes or No" Visible="false"></asp:Label>
    <table style="width:100%;">
        <tr>
            <td class="auto-style2">
                <asp:RadioButton ID="RadioButton3" GroupName="rresearch" runat="server" Text="Yes, I agree to be on the Research Registry list. " />
            </td>
        </tr>
        <tr>
            <td class="auto-style2">
                <strong>OR</strong></td>
        </tr>
        <tr>
            <td class="auto-style2">
                <asp:RadioButton ID="RadioButton4" GroupName="rresearch" runat="server" Text="No, I do not want to be on the Research Registry list." />
            </td>
        </tr>
    </table>
0

You dont have to use the radiobuttonlist, you can continue to use them independently. Did you click on the link I provided above? both solutions are covered. Without the button list, you can use client side javascript for the validation, then double check server side via if (Page.IsValid).

0

Ok. Thanks. I think this is exactly what I needed. I'm reading through that thread now. I think I can also use a msgbox or something if I'm able to use Javascript. I have never used javascript and vb.net on the same page. I will try using 2 <script> tags. I will let you know how it works out.

0

msgbox? I think you are confusing asp.net with Windows.Forms.

Javascript is added to your page in the same way you would include standard HTML. Asp.net will ignore it and pass the markup to the client upon the page request. HTML and JavaScript is processed client side. Your asp.net controls and vb/c# code is processed server side, then the server generates the appropriate HTML.

As you may or may not be aware of but browsers don't know anything about asp.net, vb.net... They only understand HTML, javascript.

0

Hey JorgeM. Thanks for all your help. That worked. Also, thanks for the explanation. I was very confused on how to use all the technologies together. I still don't fully understand it. But I understood it enough to get the form working.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.