Displaying Total in Footer of GridView and also Add Sum of columns(row vise) in last Column

前端 未结 4 1659
离开以前
离开以前 2020-12-07 01:12

In my Asp.net App, i have a GridView and i generate the data of column[6] by myself using code behind.

by looking at the code below, i have

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 01:59

         
                                                                        
                                                                            
                                                                        
                                                                        
                                                                        
                                                                        
                                                                            
                                                                        
                                                                    
    
    
     private void TotalExEmpOFMonth()
        {
            Label lbl_TotNoOfExEmp = (Label)GrdPFRecord.FooterRow.FindControl("lblTotNoOfExEmp");
            /*Sum of the  Total Amount Of month*/
            foreach (GridViewRow gvr in GrdPFRecord.Rows)
            {
                TextBox txt_NoOfExEmp = (TextBox)gvr.FindControl("txtNoOfExEmp");
                lbl_TotNoOfExEmp.Text = (Convert.ToDouble(txt_NoOfExEmp.Text) + Convert.ToDouble(lbl_TotNoOfExEmp.Text)).ToString();
                lbl_TotNoOfExEmp.Text = string.Format("{0:F0}", Decimal.Parse(lbl_TotNoOfExEmp.Text));
    
    
    
            }
        }
    

提交回复
热议问题