<table width="100%"> <tr> <td> <asp:UpdatePanel ID="UpdatePanel11" runat="server"> <ContentTemplate> <asp:GridView ID="dgvAttandance" runat="server" AutoGenerateColumns="false" DataKeyNames="StffId" Width="100%" CssClass="style5"> <Columns> <asp:TemplateField HeaderText="Stff Id" HeaderStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:Label ID="lblStffId" runat="server" Text='<%# Bind("StffId")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Name" HeaderStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:Label ID="lblName" runat="server" Text='<%# Bind("Name")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Date Time" HeaderStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:Label ID="lblDT" runat="server" Text='<%# Bind("DT")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Attendance"> <ItemTemplate> <asp:RadioButton ID="rdoP" Text="P" ForeColor="Green" Font-Bold="true" runat="server" Checked="true" GroupName="Att" /> <asp:RadioButton ID="rdoA" Text="A" ForeColor="Blue" Font-Bold="true" runat="server" Checked="false" GroupName="Att" /> <asp:RadioButton ID="rdoS" Text="S" ForeColor="Red" Font-Bold="true" runat="server" Checked="false" GroupName="Att" /> <asp:RadioButton ID="rdoH" Text="H" ForeColor="Orange" Font-Bold="true" runat="server" Checked="false" GroupName="Att" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </ContentTemplate> </asp:UpdatePanel> </td> </tr> </table>
for (int index = 0; index <= dgvAttandance.Rows.Count - 1; index++) { char stat = new char(); RadioButton P = (RadioButton)dgvAttandance.Rows[index].FindControl("rdoP"); RadioButton A = (RadioButton)dgvAttandance.Rows[index].FindControl("rdoA"); RadioButton S = (RadioButton)dgvAttandance.Rows[index].FindControl("rdoS"); RadioButton H = (RadioButton)dgvAttandance.Rows[index].FindControl("rdoH"); if (P.Checked) { stat = Convert.ToChar("P"); } else if (A.Checked) { stat = Convert.ToChar("A"); } else if (S.Checked) { stat = Convert.ToChar("S"); } else if (H.Checked) { stat = Convert.ToChar("H"); } DT.Rows.Add(((Label)dgvAttandance.Rows[index].FindControl("lblStffId")).Text, ((Label)dgvAttandance.Rows[index].FindControl("lblName")).Text, stat); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)