protected void dlPaySlipOffice_ItemDataBound(object sender, DataListItemEventArgs e) { try { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { PaySlipBl objPaySlipBl = new PaySlipBl(); ApplicationResult objResult = new ApplicationResult(); GridView gvEarning = new GridView(); gvEarning = (GridView)e.Item.FindControl("gvEarning12"); GridView gvDeduction = new GridView(); gvDeduction = (GridView)e.Item.FindControl("gvDeduction12"); GridView gvLeave = new GridView(); gvLeave = (GridView)e.Item.FindControl("gvLeave12"); Label lblMonth = (Label)e.Item.FindControl("lblMonth12"); lblMonth.Text = ddlMonth.SelectedItem.ToString() + " " + ddlYear.SelectedItem.ToString(); Label lblAmountInWords = (Label)e.Item.FindControl("lblAmountInWords12"); CommonFunctions objFuction = new CommonFunctions(); string strAmount = objFuction.ConvertInWords(Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "NetSalary").ToString())); lblAmountInWords.Text = Convert.ToString(strAmount); objResult = objPaySlipBl.Select_EmployeeDetail_ForPaySlipPrint(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), Convert.ToInt32(hfEmployeeMID.Value), Convert.ToInt32(ddlMonth.SelectedValue), Convert.ToInt32(ddlYear.SelectedValue), 1); if (objResult != null) { gvEarning.DataSource = null; //gvReport.DataSource = null; gvEarning.DataSource = objResult.resultDT; gvEarning.DataBind(); if (objResult.resultDT.Rows.Count > 0) { gvEarning.Visible = true; } } objResult = objPaySlipBl.Select_EmployeeDetail_ForPaySlipPrint(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), Convert.ToInt32(hfEmployeeMID.Value), Convert.ToInt32(ddlMonth.SelectedValue), Convert.ToInt32(ddlYear.SelectedValue), 2); if (objResult != null) { gvDeduction.DataSource = null; //gvReport.DataSource = null; gvDeduction.DataSource = objResult.resultDT; gvDeduction.DataBind(); if (objResult.resultDT.Rows.Count > 0) { gvDeduction.Visible = true; } } objResult = objPaySlipBl.Select_EmployeeDetail_ForPaySlipPrint(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), Convert.ToInt32(hfEmployeeMID.Value), Convert.ToInt32(ddlMonth.SelectedValue), Convert.ToInt32(ddlYear.SelectedValue), 3); if (objResult != null) { gvLeave.DataSource = null; //gvReport.DataSource = null; gvLeave.DataSource = objResult.resultDT; gvLeave.DataBind(); if (objResult.resultDT.Rows.Count > 0) { gvLeave.Visible = true; } } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }