protected void btncancel_Click(object sender, EventArgs e) { try { DCMaster _objDC = new DCMaster(); DCDetails _objdetails = new DCDetails(); if (Pflag == true) { if (lbldocumentno.Text != "") { foreach (GridViewRow row in grdOrderDetails.Rows) { _objdetails.DCDetailID = Convert.ToInt32(((Label)row.FindControl("lbldcdetailid")).Text); _objdetails.CanceledQty = Convert.ToInt32(((Label)row.FindControl("lblavailable")).Text); _objdetails.Cancel = false; _objdetails.PCancel = true; _objdetails.UpdateDCDetails(); } _objDC.DocNo = Convert.ToInt32(lbldocumentno.Text.ToString()); _objDC.IsCanceled = true; _objDC.FinancialYearFrom = Convert.ToInt32(strFY); _objDC.Remark = txtRemark.Text.ToString(); _objDC.update(1); tabledetails.Visible = false; } // message("Is Partial True"); } else { // message("Is Partial False"); if (lbldocumentno.Text != "") { foreach (GridViewRow row in grdOrderDetails.Rows) { _objdetails.DCDetailID = Convert.ToInt32(((Label)row.FindControl("lbldcdetailid")).Text); _objdetails.CanceledQty = Convert.ToInt32(((Label)row.FindControl("lblavailable")).Text); _objdetails.Cancel = true; _objdetails.PCancel = false; _objdetails.UpdateDCDetails(); } _objDC.DocNo = Convert.ToInt32(lbldocumentno.Text.ToString()); _objDC.IsCanceled = true; _objDC.FinancialYearFrom = Convert.ToInt32(strFY); _objDC.Remark = txtRemark.Text.ToString(); _objDC.update(1); } } ClearData(); // btncancel.Visible = false; PnlCancel(false); } catch { } }