protected void btnUpdateCD_Click(object sender, EventArgs e)
    {
        try
        {
            tdmsg.Visible = false;
            lblMainMsg.Text = "";

            if (ViewState["CommissionApis"] != null)
            {
                ObjDatatable = (DataTable)ViewState["CommissionApis"];

                ObjDataview = new DataView(ObjDatatable);
                ObjDataview.RowFilter = "Api='" + Convert.ToString(txtApi.Text) + "'";
                if (ObjDataview.Count > 0)
                {
                    tdmsg.Visible = true;
                    tdmsg.Style.Add("background-color:#E77471;", "");
                    lblMainMsg.Text = "Already Api with this name has been created ...";
                    lblMainMsg.ForeColor = System.Drawing.Color.Maroon;

                }
                else
                {

                    objBAL = new ClsBAL();
                    objBAL.ID = Convert.ToInt32(lblCommissionID.Text);
                    objBAL.api = txtApi.Text;
                    objBAL.percentage = txtPercentage.Text;
                    objBAL.modifiedBy = Convert.ToInt32(Session["UserID"]);
                    if (objBAL.UpdateCommission())
                    {
                        tdmsg.Visible = true;
                        tdmsg.Style.Add("background-color:#6CC417;", "");
                        lblMainMsg.Text = "Commission details saved Successfully....";
                        lblMainMsg.ForeColor = System.Drawing.Color.Green;
                        BindApis();
                        MVUsers.ActiveViewIndex = 0; MVUsers.Visible = true;
                    }
                    else
                    {
                        tdmsg.Visible = true;
                        tdmsg.Style.Add("background-color:#E77471;", "");
                        lblMainMsg.Text = "OOPS...Failed to save Commission details....";
                        lblMainMsg.ForeColor = System.Drawing.Color.Maroon;
                    }
                }
            }

        }
        catch (Exception ex)
        {
            objBAL.Logerror(this.Page.ToString(), "btnUpdateCD_Click", ex.Message.ToString(), Convert.ToString(ex.InnerException), Convert.ToString(Request.UserHostAddress.ToString()), DateTime.Now);
            throw ex;
        }
    }