Question : Validate multiple radiobuttonlist validation with error message each group

I have this codes to validate a set of radiobutton list , list items controls in my questionarie., question is how can I extend it to validate all questions e.g.

radiobuttonlist2, radiobuttonlist3,.......  

and display which question was not not answered. ,,,,

thanks and look forward for assistance..
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:
<script type = "text/javascript">

    function Validate() {

        var RB1 = document.getElementById("<%=RadioButtonList1.ClientID%>");

        var radio = RB1.getElementsByTagName("input");

        var isChecked = false;

        for (var i = 0; i < radio.length; i++) {

            if (radio[i].checked) {

                isChecked = true;
                break;

            }

        }

        if (!isChecked) {

            alert("Please select an option in each question");

        }

        return isChecked;

    }

</script>


Control:
 <asp:RadioButtonList ID="RadioButtonList1" repeatdirection="Vertical" runat="server">
                
                    <asp:ListItem Value="Yes"></asp:ListItem>
                    <asp:ListItem Value="No"></asp:ListItem>
                 </asp:RadioButtonList>

Answer : Validate multiple radiobuttonlist validation with error message each group

Why don't you use built-in asp.net RequiredFieldValidator to do this work.
You can set message per validator and also use ValidationSummary to display all messages.
Sample: http://www.dotnetfunda.com/codes/code81-validating-radio-button-list-using-required-filed-validator.aspx
Random Solutions  
 
programming4us programming4us