private void BindControl(string szCaseid)
    {
        _associatedCases = new Bill_Sys_AssociatedCases();
        _arrayList       = new ArrayList();
        try
        {
            //divAssociatedCases.InnerHtml = "";
            Boolean status = false;
            _arrayList = _associatedCases.GetAssociatedCases(szCaseid, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
            for (int i = 0; _arrayList.Count > i; i++)
            {
                //HyperLink lnk = new HyperLink();
                string strURL = "";
                status = true;
                if (i == 0)
                {
                    //lnk.ID = lnk + "_" + i;
                    //lnk.Text = _arrayList[i].ToString();
                    //lnk.CommandArgument = _arrayList[i].ToString();

                    //lnk.CssClass = "sub-menu";
                    //lnk.PostBackUrl = "../Bill_Sys_CaseDetails.aspx?CaseID=" + _arrayList[i].ToString();
                    strURL = "Bill_Sys_CaseDetails.aspx?CaseID=" + _arrayList[i].ToString();
                    //divAssociatedCases.InnerHtml = divAssociatedCases.InnerHtml + "<li><a href='" + strURL + "' class='sub-menu'>" + _arrayList[i].ToString() + "</a></li>";
                    szHTML = szHTML + "<li><a href='" + strURL + "' class='sub-menu'>" + _arrayList[i].ToString() + "</a></li>";
                }
                else
                {
                    //lnk.ID = lnk + "_" + i;
                    //lnk.Text = _arrayList[i].ToString() + " | ";
                    ////lnk.CommandArgument = _arrayList[i].ToString();
                    //lnk.CssClass = "sub-menu";
                    //lnk.NavigateUrl = "../Bill_Sys_CaseDetails.aspx?CaseID=" + _arrayList[i].ToString();
                    ////lnk.PostBackUrl = "../Bill_Sys_CaseDetails.aspx?CaseID=" + _arrayList[i].ToString();
                    ////divAssociatedCases.Controls.Add("<span>|<span>");
                    //divAssociatedCases.Controls.Add(lnk);
                    strURL = "Bill_Sys_CaseDetails.aspx?CaseID=" + _arrayList[i].ToString();
                    //divAssociatedCases.InnerHtml = divAssociatedCases.InnerHtml + " | " + "<li><a href='" + strURL + "'  class='sub-menu'>" + _arrayList[i].ToString() + "</a></li>";
                    szHTML = szHTML + "<li><a href='" + strURL + "' class='sub-menu'>" + _arrayList[i].ToString() + "</a></li>";
                }
                // string strCaseID = "Bill_Sys_CaseDetails.aspx " + "?CaseID=" + _arrayList[i].ToString();
                //if (i == 0) { divAssociatedCases.InnerHtml = divAssociatedCases.InnerHtml + ":  " + "<a href=" + strCaseID + ">"+_arrayList[i].ToString()+"</a>"; }
                //else { divAssociatedCases.InnerHtml = divAssociatedCases.InnerHtml + " | " + "<a href=" + strCaseID + ">"+_arrayList[i].ToString()+"</a>"; }
            }
            //if (status == true)
            //{
            //    divAssociatedCases.Visible=true;
            //}
            //else { divAssociatedCases.Visible = false; }
        }
        catch (Exception ex)
        {
            string strError = ex.Message.ToString();
            strError = strError.Replace("\n", " ");
            Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + strError);
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            if (Request.QueryString["diagnosisId"] != null)
            {
                if (Request.QueryString["diagnosisId"].ToString() != "")
                {
                    _dill_Sys_ProcedureCode_BO = new Bill_Sys_AssociatedCases();
                    DataSet ds = new DataSet();
                    ds = _dill_Sys_ProcedureCode_BO.GetAssociatedProcedure(Request.QueryString["diagnosisId"].ToString().Trim(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    grdProcedureCode.DataSource = ds.Tables[0];
                    grdProcedureCode.DataBind();
                    for (int intLoop = 0; intLoop < ds.Tables[0].Rows.Count; intLoop++)
                    {
                        foreach (DataGridItem dgiProcedureCode in grdProcedureCode.Items)
                        {
                            if (dgiProcedureCode.ItemIndex == intLoop && ((Boolean)ds.Tables[0].Rows[intLoop]["CHECKED"]) == true)
                            {
                                CheckBox chkEmpty = (CheckBox)dgiProcedureCode.Cells[0].FindControl("chkSelect");
                                chkEmpty.Checked = true;
                            }
                        }
                    }
                }
                else
                {
                    this.Dispose();
                }
            }
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
    protected void btnAssociate_Click(object sender, EventArgs e)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            ArrayList arrayList;
            foreach (DataGridItem dgiProcedureCode in grdProcedureCode.Items)
            {
                CheckBox chkEmpty = (CheckBox)dgiProcedureCode.Cells[1].FindControl("chkSelect");
                if (chkEmpty.Checked == true)
                {
                    arrayList = new ArrayList();
                    arrayList.Add(Request.QueryString["diagnosisId"].ToString().Trim());
                    arrayList.Add(dgiProcedureCode.Cells[1].Text);
                    arrayList.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    _dill_Sys_ProcedureCode_BO = new Bill_Sys_AssociatedCases();

                    _dill_Sys_ProcedureCode_BO.InsertAssociatedCases(arrayList);
                }
                lblMsg.Text = "Procedure code is successfully associated";
            }
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }