Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void DeleteLateAttendance()
        {
            LateAttendanceRepository LateRepository = new LateAttendanceRepository();
            LateAttendanceApprovalDto LateApprovalDto = new LateAttendanceApprovalDto();
            int count = grdLateAttendance.Rows.Count;
            foreach (GridViewRow gvRow in grdLateAttendance.Rows)
            {
                CheckBox chk = gvRow.FindControl("chkDelete") as CheckBox;
                if (chk != null && chk.Checked)
                {
                    LateApprovalDto.LateAttendanceApprovalID= gvRow.Cells[1].Text.Trim();
                    LateRepository.DeleteLateAttendance(LateApprovalDto.LateAttendanceApprovalID);
                }

            }
        }

This grid view count zero.but grid view contain 3 rows.
Posted
Updated 21-Oct-12 21:21pm
v2
Comments
Ambesha 22-Oct-12 3:21am    
not enough information to look into this issue
Sanjay K. Gupta 22-Oct-12 3:23am    
Before calling the 'DeleteLateAttendance()" function, bind the Grid
as
grdLateAttendance.DataBind();
bbirajdar 22-Oct-12 3:35am    
where are you binding it ?

1 solution

call Your bindGrid method in !ispostback of pageload and see is the grid binding completely??? there should be problem in binding grid one or more column must not be binded to grid then it happends dataset would have 3 rows but not grid have after binding...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900