May 5, 2011

To Use RadioButtonList in ASP.Net

On aspx page

<asp:RadioButtonList ID="rblDC" runat="server" RepeatDirection="Horizontal">
   <asp:ListItem Text="Good"></asp:ListItem>
   <asp:ListItem Text="Bad"></asp:ListItem>
</asp:RadioButtonList>

In Javascript

if (!document.forms[0].rblDC[0].checked && !document.forms[0].rblDC[1].checked)
  { 
        alert('Please select value');
        return false;
   }

On CS page

string DC = rblDC.SelectedValue.ToString()

No comments:

Post a Comment