Background: The problem i have with my code is the following, upon click a button the checkbox doesn't get the checked checkboxes, but in the second click just get all the checked checkboxes.
Here the code:
ASPX This button execute the process..
<asp:LinkButton ID="lbDeletePerman" runat="server" OnClick="lbDeletePerman_Click">Yes</asp:LinkButton>
<asp:GridView CssClass="da-table" ID="Gv_A" runat="server" DataKeyNames="ID,PatientName" AutoGenerateColumns="false" OnRowCommand="Gv_Appoint_RowCommand">
<Columns>
<asp:TemplateField HeaderStyle-Font-Bold="true" HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="CbE" runat="server" />
<asp:HiddenField ID="hID" Value='<%# Eval("IDENTIFICATION") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField=""Date" HeaderText="Date" HeaderStyle-Font-Bold="true" HeaderStyle-VerticalAlign="Middle" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField DataField="Cat" HeaderText="Type" HeaderStyle-Font-Bold="true" HeaderStyle-VerticalAlign="Middle" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField DataField="Deleted" HeaderText="Deleted" HeaderStyle-Font-Bold="true" HeaderStyle-VerticalAlign="Middle" ItemStyle-VerticalAlign="Middle" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
C#:
protected void lbDeletePerman_Click(object sender, EventArgs e) { try { foreach (GridViewRow rowItem in Gv_Appoint.Rows) { CheckBox CboxElim = (CheckBox)(rowItem.Cells[0].FindControl("CbDelApprst")); if (CboxElim.Checked) { LBLT.Text = "Hello"; // NO ENTERING HERE } } GVUpdatePanel.Update(); } catch (Exception er){} }
Will be appreciated whatever help.
Aucun commentaire:
Enregistrer un commentaire