protected void btnNewAdd_Click(object sender, EventArgs e)
        {
            try
            {
                ML_Common.SetDropDownValue(ddlCokeType, -1);
                ML_Common.SetDropDownValue(ddlCokeSupplier, -1);
                ML_Common.SetDropDownValue(ddlAnalysisType, -1);
                txtFieldSize.Text = string.Empty;
                txtFieldUnit.Text = string.Empty;
                txtFieldSpec.Text = string.Empty;
                txtMinValue.Text  = string.Empty;
                txtMaxValue.Text  = string.Empty;



                ViewState["dtCokeDynamic"] = null;
                dtCokeDynamic = new DataTable();
                dtCokeDynamic = BindCokeDynamicDataTable();

                dtCokeDynamic.Rows.Add(dtCokeDynamic.NewRow());
                grdCokeDynamic.DataSource = dtCokeDynamic;
                grdCokeDynamic.DataBind();

                //int TotalColumns = grdCokeComposite.Rows[0].Cells.Count;
                //grdCokeComposite.Rows[0].Cells.Clear();
                //grdCokeComposite.Rows[0].Cells.Add(new TableCell());
                //grdCokeComposite.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                //grdCokeComposite.Rows[0].Cells[0].Text = "No Record Found";

                btnSubmit.Visible = false;
                btnNewAdd.Visible = false;



                UpdatePanelSave.Update();
                UpdatePanelGrid.Update();
            }
            catch (Exception ex)
            {
                Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (btnAdd.Enabled)
                {
                    DataRow dr;

                    if (ViewState["dtCokeDynamic"] == null)
                    {
                        dtCokeDynamic = new DataTable();
                        dtCokeDynamic = BindCokeDynamicDataTable();
                    }
                    else
                    {
                        dtCokeDynamic = (DataTable)ViewState["dtCokeDynamic"];
                    }



                    dr = dtCokeDynamic.NewRow();
                    dr["CokeTypeId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true));
                    dr["CokeType"]   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false));


                    dr["CokeSupplierId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplier, true));
                    dr["CokeSupplier"]   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplier, false));
                    //dr["NameofParty"] = dr["CokeSupplier"];

                    dr["AnalysisTypeId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true));
                    dr["AnalysisType"]   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false));
                    //dr["NameofAnalysis"] = dr["AnalysisType"];

                    //dr["SampleNo"] = dtFlowMetrDataTable.Rows.Count + 1;// ML_Common.string2int32(ML_Common.clean(txtSampleNo.Text));
                    //dr["SamplingDate"] = ML_Common.ToDateTimeSafeNull(txtSamplingDate.Text);
                    //dr["StoreSINo"] = ML_Common.string2int32(ML_Common.clean(txtStoreSINo.Text));
                    //dr["SampleDetail"] = ML_Common.clean(txtSampleDetail.Text);

                    dr["FieldSize"] = ML_Common.clean(txtFieldSize.Text);
                    dr["FieldUnit"] = ML_Common.clean(txtFieldUnit.Text);
                    dr["FieldSpec"] = ML_Common.clean(txtFieldSpec.Text);
                    dr["MinValue"]  = ML_Common.clean(txtMinValue.Text);
                    dr["MaxValue"]  = ML_Common.clean(txtMaxValue.Text);



                    dtCokeDynamic.Rows.Add(dr);

                    //DtList = (DataTable)ViewState["grdStartupBathTapping"];
                    if (dtCokeDynamic.Rows.Count > 0)
                    {
                        ViewState["dtCokeDynamic"] = dtCokeDynamic;
                        grdCokeDynamic.DataSource  = dtCokeDynamic;
                        grdCokeDynamic.DataBind();
                    }
                    else
                    {
                        dtCokeDynamic.Rows.Add(dtCokeDynamic.NewRow());
                        grdCokeDynamic.DataSource = dtCokeDynamic;
                        grdCokeDynamic.DataBind();

                        int TotalColumns = grdCokeDynamic.Rows[0].Cells.Count;
                        grdCokeDynamic.Rows[0].Cells.Clear();
                        grdCokeDynamic.Rows[0].Cells.Add(new TableCell());
                        grdCokeDynamic.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                        grdCokeDynamic.Rows[0].Cells[0].Text       = "No Record Found";
                    }


                    txtFieldSize.Text = string.Empty;
                    txtFieldUnit.Text = string.Empty;
                    txtFieldSpec.Text = string.Empty;
                    txtMinValue.Text  = string.Empty;
                    txtMaxValue.Text  = string.Empty;



                    UpdatePanelGrid.Update();
                    btnSubmit.Visible = true;

                    btnSubmit.BackColor = System.Drawing.ColorTranslator.FromHtml("#5bc0de");
                    btnSubmit.ForeColor = System.Drawing.Color.White;



                    btnNewAdd.Visible = true;
                    // btnNewAdd.BackColor = System.Drawing.Color.Green;
                    btnNewAdd.BackColor = System.Drawing.ColorTranslator.FromHtml("#5bc0de");
                    btnSubmit.ForeColor = System.Drawing.Color.White;
                    UpdatePanelSave.Update();
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message.ToString();
            }
        }
        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);
                }
            }
        }