I have created a sample for your reference.
HTML
<div>
<asp:RadioButtonList ID="rblTest" runat="server">
<asp:ListItem Text="Mango" Value="Mango"></asp:ListItem>
<asp:ListItem Text="Banana" Value="Banana"></asp:ListItem>
<asp:ListItem Text="Orange" Value="Orange"></asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Button ID="btnValidate" OnClick="btnValidate_Click" runat="server" Text="Validate" />
</div>
C#
protected void btnValidate_Click(object sender, EventArgs e)
{
if (rblTest.SelectedIndex == -1)
{
string message = "alert('" + "Please select an option." + "');";
ClientScript.RegisterStartupScript(this.GetType(), "Error_message", message, true);
return;
}
}
VB.Net
Protected Sub btnValidate_Click(ByVal sender As Object, ByVal e As EventArgs)
If rblTest.SelectedIndex = -1 Then
Dim message As String = "alert('" & "Please select an option." & "');"
ClientScript.RegisterStartupScript(Me.[GetType](), "Error_message", message, True)
Return
End If
End Sub
Screenshot
