private void BindGrid(int ProcessId)
        {
            Dictionary <string, string> genDictIsRejected         = new Dictionary <string, string>();
            Dictionary <string, string> genDictRejectReason       = new Dictionary <string, string>();
            Dictionary <string, string> genDictIsCustomerExisting = new Dictionary <string, string>();

            try
            {
                if (hdnCurrentPage.Value.ToString() != "")
                {
                    mypager.CurrentPage  = Int32.Parse(hdnCurrentPage.Value.ToString());
                    hdnCurrentPage.Value = "";
                }

                int Count;

                rejectedRecordsBo = new RejectedRecordsBo();

                if (ProcessId == 0)
                {   // Bind All Processes
                    dsRejectedRecords = rejectedRecordsBo.getSuperAdminMFRejectedFolios(ProcessId, mypager.CurrentPage, out Count, hdnSortProcessID.Value, hdnIsRejectedFilter.Value, hdnPANFilter.Value.Trim(), hdnRejectReasonFilter.Value, hdnNameFilter.Value.Trim(), hdnFolioFilter.Value.Trim(), hdnAdviserFilter.Value);
                }
                else
                {   // Bind Grid for the specific Process Id
                    dsRejectedRecords = rejectedRecordsBo.getSuperAdminMFRejectedFolios(ProcessId, mypager.CurrentPage, out Count, hdnSortProcessID.Value, hdnIsRejectedFilter.Value, hdnPANFilter.Value.Trim(), hdnRejectReasonFilter.Value, hdnNameFilter.Value.Trim(), hdnFolioFilter.Value.Trim(), hdnAdviserFilter.Value);
                }

                lblTotalRows.Text = hdnRecordCount.Value = Count.ToString();
                if (Count > 0)
                {
                    DivPager.Style.Add("display", "visible");
                }

                if (dsRejectedRecords.Tables[0].Rows.Count > 0)
                {   // If Records found, then bind them to grid
                    trProfileMessage.Visible = false;
                    trReprocess.Visible      = true;

                    gvCAMSProfileReject.DataSource = dsRejectedRecords.Tables[0];
                    gvCAMSProfileReject.DataBind();

                    if (dsRejectedRecords.Tables[2].Rows.Count > 0)
                    {
                        // Get the Reject Reason Codes Available into Generic Dictionary
                        foreach (DataRow dr in dsRejectedRecords.Tables[2].Rows)
                        {
                            genDictRejectReason.Add(dr["WRR_RejectReasonDescription"].ToString(), dr["WRR_RejectReasonCode"].ToString());
                        }

                        DropDownList ddlRejectReason = GetRejectReasonDDL();
                        if (ddlRejectReason != null)
                        {
                            ddlRejectReason.DataSource     = genDictRejectReason;
                            ddlRejectReason.DataTextField  = "Key";
                            ddlRejectReason.DataValueField = "Value";
                            ddlRejectReason.DataBind();
                            ddlRejectReason.Items.Insert(0, new ListItem("Select Reject Reason", "Select Reject Reason"));
                        }

                        if (hdnRejectReasonFilter.Value != "")
                        {
                            ddlRejectReason.SelectedValue = hdnRejectReasonFilter.Value.ToString().Trim();
                        }
                    }

                    if (dsRejectedRecords.Tables[3].Rows.Count > 0)
                    {
                        // Get Is Reject Flags Available into Generic Dictionary
                        foreach (DataRow dr in dsRejectedRecords.Tables[3].Rows)
                        {
                            genDictIsRejected.Add(dr["IsRejected"].ToString(), dr["IsRejected"].ToString());
                        }

                        DropDownList ddlReject = GetIsRejectedDDL();
                        if (ddlReject != null)
                        {
                            ddlReject.DataSource     = genDictIsRejected;
                            ddlReject.DataTextField  = "Key";
                            ddlReject.DataValueField = "Value";
                            ddlReject.DataBind();
                            ddlReject.Items.Insert(0, new ListItem("Select Is Reject Flag", "Select Is Reject Flag"));
                        }

                        if (hdnIsRejectedFilter.Value != "")
                        {
                            ddlReject.SelectedValue = hdnIsRejectedFilter.Value.ToString().Trim();
                        }
                    }

                    //if (dsRejectedRecords.Tables[4].Rows.Count > 0)
                    //{
                    //    // Get Is Customer Exist Flag into Generic Dictionary
                    //    foreach (DataRow dr in dsRejectedRecords.Tables[4].Rows)
                    //    {
                    //        genDictIsCustomerExisting.Add(dr["CustomerExists"].ToString(), dr["CustomerExists"].ToString());
                    //    }

                    //    DropDownList ddlCustExists = GetCustExistsDDL();
                    //    if (ddlCustExists != null)
                    //    {
                    //        ddlCustExists.DataSource = genDictIsCustomerExisting;
                    //        ddlCustExists.DataTextField = "Key";
                    //        ddlCustExists.DataValueField = "Value";
                    //        ddlCustExists.DataBind();
                    //        ddlCustExists.Items.Insert(0, new ListItem("Select a Flag", "Select a Flag"));
                    //    }

                    //    if (hdnIsCustomerExistingFilter.Value != "")
                    //    {
                    //        ddlCustExists.SelectedValue = hdnIsCustomerExistingFilter.Value.ToString().Trim();
                    //    }
                    //}

                    TextBox txtName  = GetNameTextBox();
                    TextBox txtFolio = GetFolioTextBox();
                    TextBox txtPan   = GetPanTextBox();

                    if (txtName != null && txtFolio != null && txtPan != null)
                    {
                        if (hdnNameFilter.Value != "")
                        {
                            txtName.Text = hdnNameFilter.Value.ToString().Trim();
                        }
                        if (hdnFolioFilter.Value != "")
                        {
                            txtFolio.Text = hdnFolioFilter.Value.ToString().Trim();
                        }
                        if (hdnPANFilter.Value != "")
                        {
                            txtPan.Text = hdnPANFilter.Value.ToString().Trim();
                        }
                    }
                    BindProcessId(dsRejectedRecords.Tables[4]);
                    BindAdviserName(dsRejectedRecords.Tables[5]);
                }
                else
                {
                    hdnRecordCount.Value           = "0";
                    gvCAMSProfileReject.DataSource = null;
                    gvCAMSProfileReject.DataBind();
                    trProfileMessage.Visible = true;
                    trReprocess.Visible      = false;
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "RejectedCAMSProfile.ascx:BindGrid()");

                object[] objects = new object[1];
                objects[0] = ProcessId;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }

            this.GetPageCount();
        }