protected void btnSubmit_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { if (btnSubmit.Enabled) { int obhReturn = -1; objBusinessClass = new BusinessLayer.BusinessClass(); objML_CokeDynamic = new ML_CokeDynamic(); //objML_CokeDynamic.Id = ML_Common.string2Long(ML_Common.clean(txtId.Text)); //objML_CokeDynamic.CokeDynamicId = ML_Common.string2Long(ML_Common.clean(txtCokeDynamicId.Text)); //objML_CokeDynamic.CokeDynamic = ML_Common.clean(txtCokeDynamic.Text); objML_CokeDynamic.CokeTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true)); objML_CokeDynamic.CokeType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false)); objML_CokeDynamic.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplier, true)); objML_CokeDynamic.CokeSupplier = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplier, false)); objML_CokeDynamic.AnalysisTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true)); objML_CokeDynamic.AnalysisType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false)); objML_CokeDynamic.FieldSize = ML_Common.clean(txtFieldSize.Text); objML_CokeDynamic.FieldUnit = ML_Common.clean(txtFieldUnit.Text); objML_CokeDynamic.FieldSpec = ML_Common.clean(txtFieldSpec.Text); objML_CokeDynamic.MinValue = ML_Common.clean(txtMinValue.Text); objML_CokeDynamic.MaxValue = ML_Common.clean(txtMaxValue.Text); for (int i = 0; i <= grdCokeDynamic.Rows.Count - 1; i++) { objML_CokeDynamic.FieldSize = string.Empty; objML_CokeDynamic.FieldUnit = string.Empty; objML_CokeDynamic.FieldSpec = string.Empty; objML_CokeDynamic.MinValue = string.Empty; objML_CokeDynamic.MaxValue = string.Empty; GridViewRow gRow = grdCokeDynamic.Rows[i]; Label lblCokeTypeID = (Label)gRow.FindControl("lblCokeTypeID"); if (lblCokeTypeID != null) { objML_CokeDynamic.CokeTypeId = ML_Common.string2int32(lblCokeTypeID.Text); } Label lblCokeType = (Label)gRow.FindControl("lblCokeType"); if (lblCokeType != null) { objML_CokeDynamic.CokeType = ML_Common.clean(lblCokeType.Text); } Label lblCokeSupplierID = (Label)gRow.FindControl("lblCokeSupplierID"); if (lblCokeSupplierID != null) { objML_CokeDynamic.CokeSupplierId = ML_Common.string2int32(lblCokeSupplierID.Text); } Label lblCokeSupplier = (Label)gRow.FindControl("lblCokeSupplier"); if (lblCokeSupplier != null) { objML_CokeDynamic.CokeSupplier = ML_Common.clean(lblCokeSupplier.Text); } Label lblAnalysisTypeID = (Label)gRow.FindControl("lblAnalysisTypeID"); if (lblAnalysisTypeID != null) { objML_CokeDynamic.AnalysisTypeId = ML_Common.string2int32(lblAnalysisTypeID.Text); } Label lblAnalysisType = (Label)gRow.FindControl("lblAnalysisType"); if (lblAnalysisTypeID != null) { objML_CokeDynamic.AnalysisType = ML_Common.clean(lblAnalysisType.Text); } Label lblFieldSize = (Label)gRow.FindControl("lblFieldSize"); if (lblFieldSize != null) { objML_CokeDynamic.FieldSize = lblFieldSize.Text; } Label lblFieldUnit = (Label)gRow.FindControl("lblFieldUnit"); if (lblFieldUnit != null) { objML_CokeDynamic.FieldUnit = lblFieldUnit.Text; } Label lblFieldSpec = (Label)gRow.FindControl("lblFieldSpec"); if (lblFieldSpec != null) { objML_CokeDynamic.FieldSpec = lblFieldSpec.Text; } Label lblMinValue = (Label)gRow.FindControl("lblMinValue"); if (lblMinValue != null) { objML_CokeDynamic.MinValue = lblMinValue.Text; } Label lblMaxValue = (Label)gRow.FindControl("lblMaxValue"); if (lblMaxValue != null) { objML_CokeDynamic.MaxValue = lblMaxValue.Text; } obhReturn = objBusinessClass.AddCokeDynamic(objML_CokeDynamic); } if (obhReturn == 1) { lblMsg.Text = "Record Update Successfully"; lblMsgEdit.Text = "Record Update Successfully"; btnSubmit.Visible = false; UpdatePanelSave.Update(); } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsgEdit.Text = "Ooops!OtherIssue..."; } txtFieldSize.Text = string.Empty; txtFieldUnit.Text = string.Empty; txtFieldSpec.Text = string.Empty; txtMinValue.Text = string.Empty; txtMaxValue.Text = string.Empty; lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; UpdatePanelSave.Update(); btnSubmit.Enabled = true; ViewState["dtCokeDynamic"] = null; dtCokeDynamic = new DataTable(); dtCokeDynamic = BindCokeDynamicDataTable(); grdCokeDynamic.DataSource = dtCokeDynamic; grdCokeDynamic.DataBind(); UpdatePanelGrid.Update(); btnAdd.Enabled = true; //btnSubmit.Visible = false; } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } }