private void BindTransferDetail()
        {
            txtLocationName.Text     = Session["AppLocation"].ToString();
            txtLocationName.ReadOnly = true;

            /*Binding Satellite ID*/
            BindFunctions BindManager = new BindFunctions();
            IQCareUtils   theUtils    = new IQCareUtils();
            DataTable     theDT       = new DataTable();

            DataSet          theDS = new DataSet();
            IPatientTransfer PatientTransferMgr = (IPatientTransfer)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientTransfer, BusinessProcess.Clinical");

            if (btnSave.Text == "Save")
            {
                tredit.Visible       = false;
                theDS                = PatientTransferMgr.GetSatelliteLocation(PatientId.ToString(), TransferId, 0, Session["SystemId"].ToString());
                txtLocationName.Text = theDS.Tables[0].Rows[0]["CurrentSatName"].ToString();
                DataView theDV = new DataView(theDS.Tables[1]);
                if (theDV.Table != null)
                {
                    theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                    BindManager.BindCombo(ddSatellite, theDT, "Name", "ID");
                    theDV.Dispose();
                    theDT.Clear();
                }
            }


            if (btnSave.Text == "Update")
            {
                tredit.Visible = true;
                theDS          = PatientTransferMgr.GetSatelliteLocation(PatientId.ToString(), TransferId, 1, Session["SystemId"].ToString());

                txtLocationNameEdit.Text    = theDS.Tables[0].Rows[0]["CurrentSatName"].ToString();
                txtLocationNameEdit.Enabled = false;
                txtFromSatellite.Text       = theDS.Tables[2].Rows[0]["TransferfromSatellite"].ToString();
                txtFromSatellite.Enabled    = false;
                ViewState["FromID"]         = theDS.Tables[2].Rows[0]["TransferredfromID"].ToString();
                //ddSatelliteEdit.Enabled = false;
                TxtTransDateEdit.Text     = string.Format("{0:dd-MMM-yyyy}", Convert.ToDateTime(theDS.Tables[2].Rows[0]["TransferredDate"]));
                ViewState["TransferDate"] = TxtTransDateEdit.Text;
                DataView theDV = new DataView(theDS.Tables[1]);
                //theDV.RowFilter = "DeleteFlag=0";
                if (theDV.Table != null)
                {
                    theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                    BindManager.BindCombo(ddSatelliteEdit, theDT, "Name", "ID");
                    theDV.Dispose();
                    theDT.Clear();
                }
                ddSatelliteEdit.SelectedValue = theDS.Tables[2].Rows[0][3].ToString();
            }
        }
    private void BindGrid()
    {
        if (ViewState["Sorted"] != null)
        {
            IPatientTransfer PatientTransferMgr = (IPatientTransfer)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientTransfer, BusinessProcess.Clinical");
            DataSet          theDS = PatientTransferMgr.GetSatelliteLocation(PatientId, TransferId, 0, Session["SystemId"].ToString());
            txtLocationName.Text = theDS.Tables[0].Rows[0]["CurrentSatName"].ToString();
            BindFunctions BindManager = new BindFunctions();
            IQCareUtils   theUtils    = new IQCareUtils();
            DataView      theDV       = new DataView(theDS.Tables[1]);
            DataTable     theDT       = new DataTable();
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddSatellite, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
            GrdTransfer.DataSource = theDS.Tables[2];
            if (ViewState["grdDataSource"] == null)
            {
                ViewState["grdDataSource"] = theDS.Tables[2];
            }
        }

        ViewState["Sorted"] = "";
        BoundField theCol0 = new BoundField();

        theCol0.HeaderText           = "ID";
        theCol0.DataField            = "ID";
        theCol0.HeaderStyle.CssClass = "textstylehidden";
        theCol0.ItemStyle.CssClass   = "textstylehidden";
        theCol0.ReadOnly             = true;

        BoundField theCol1 = new BoundField();

        theCol1.HeaderText         = "From Location";
        theCol1.DataField          = "TransferfromSatellite";
        theCol1.ItemStyle.CssClass = "textstyle";
        theCol1.SortExpression     = "TransferfromSatellite";
        theCol1.ReadOnly           = true;

        BoundField theCol2 = new BoundField();

        theCol2.HeaderText         = "To Location";
        theCol2.DataField          = "TransfertoSatellite";
        theCol2.ItemStyle.CssClass = "textstyle";
        theCol2.SortExpression     = "TransfertoSatellite";
        theCol2.ReadOnly           = true;

        BoundField theCol3 = new BoundField();

        theCol3.HeaderText         = "Transferred Date";
        theCol3.DataField          = "TransferredDate";
        theCol3.ItemStyle.CssClass = "textstyle";
        theCol3.SortExpression     = "TransferredDate";
        theCol3.ReadOnly           = true;

        ButtonField theBtn = new ButtonField();

        theBtn.ButtonType           = ButtonType.Link;
        theBtn.CommandName          = "Select";
        theBtn.HeaderStyle.CssClass = "textstylehidden";
        theBtn.ItemStyle.CssClass   = "textstylehidden";

        GrdTransfer.Columns.Add(theCol0);
        GrdTransfer.Columns.Add(theCol1);
        GrdTransfer.Columns.Add(theCol2);
        GrdTransfer.Columns.Add(theCol3);
        GrdTransfer.Columns.Add(theBtn);
        GrdTransfer.DataBind();
    }