Please help me out I am having a Gridview named GridViewGender with a RadioButtonList with it Inline code is
<asp:GridView ID="GridViewGender" runat="server"
AutoGenerateColumns="False"
Width="494px" DataKeyNames="ren">
<Columns>
<asp:BoundField DataField="ren" HeaderText="Items" />
<asp:TemplateField HeaderText="Attendance" >
<ItemTemplate>
<asp:RadioButtonList ID="RadioButtonListGender" runat="server" Enabled="true"
RepeatDirection="Horizontal" TextAlign="Left"
>
<asp:ListItem Value="1">Male</asp:ListItem>
<asp:ListItem Value="2">Female</asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void Page_Load(object sender, EventArgs e)
{
MyClass obj = new MyClass ();
GridViewGender.DataSource = obj.check();
GridViewGender.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
List<string> checking = new List<string>();
for(int i = 0 ; i < GridViewGender.Rows.Count ; i ++)
{
GridViewRow row = GridViewGender.Rows[i];
string rr = Convert.ToString( ((RadioButtonList)row.FindControl("RadioButtonListGender")).SelectedItem.Text) ;
checking .Add((string.IsNullOrEmpty(rr)) ? string.Empty : rr);
}
}