public DataTable GetMFAccountLists()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add(new DataColumn(DKEY_ACCOUNT_ID));
        dt.Columns.Add(new DataColumn(DKEY_ACCOUNT_NO));
        dt.Columns.Add(new DataColumn(DKEY_ACCOUNT_NAME));

        IList <MFAccount> accountLists = null;

        if (0 != this.investmentPlannerID)
        {
            accountLists = MFAccount.List(iSabayaContext, InvestmentPlanner.Find(iSabayaContext, this.investmentPlannerID));
        }
        else
        {
            accountLists = MFAccount.List(iSabayaContext);
        }

        foreach (MFAccount item in accountLists)
        {
            if (item.EffectivePeriod.Includes(DateTime.Now))
            {
                DataRow dr = dt.NewRow();
                dr[DKEY_ACCOUNT_ID]   = item.AccountID;
                dr[DKEY_ACCOUNT_NO]   = item.AccountNo;
                dr[DKEY_ACCOUNT_NAME] = item.Name.ToString(LanguageCode);
                dt.Rows.Add(dr);
            }
        }
        return(dt);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            cboAccountNo.SetValidation(ValidationGroup, IsRequiredField);
            lblMFCustomerName.ClientInstanceName = (lblAccountDetail != null ? lblAccountDetail : lblMFCustomerName.ClientID);
            Session[this.GetType().ToString() + "GridMFAccount"]  = null;
            Session[this.GetType().ToString() + "MFAccountLists"] = null;

            //game
            lblMFCustomerName.Cursor = "pointer";
        }

        if (Session[this.GetType().ToString() + "GridMFAccount"] != null)
        {
            IList <MFAccount_MFAccountControl_Vo> vos = (IList <MFAccount_MFAccountControl_Vo>)Session[this.GetType().ToString() + "GridMFAccount"];

            GridCustomer.DataSource = vos;
            GridCustomer.DataBind();

            cboAccountNo.DataSource = Session[this.GetType().ToString() + "MFAccountLists"];
            cboAccountNo.DataBind();
        }
        else
        {
            if (IsPostBack == false)
            {
                IList <MFAccount> mfaccounts   = MFAccount.List(iSabayaContext);
                List <MFAccount>  resultCanSee = new List <MFAccount>();
                this.User.Person.FilterPortfolios(iSabayaContext, mfaccounts, resultCanSee);

                if (Session["ctrls_MFAccountControlNew_mfaccounts"] == null)
                {
                    JsonObjectCollection json = new JsonObjectCollection();
                    foreach (MFAccount account in resultCanSee)
                    {
                        json.Add(new JsonStringValue(account.AccountID + "", account.Name.ToString()));
                    }
                    Session["ctrls_MFAccountControlNew_mfaccounts"] = json.ToString();
                }

                IList <MFAccount_MFAccountControl_Vo> vos = new List <MFAccount_MFAccountControl_Vo>();
                foreach (MFAccount a in resultCanSee)
                {
                    vos.Add(new MFAccount_MFAccountControl_Vo(this.LanguageCode, a));
                }
                Session[this.GetType().ToString() + "GridMFAccount"] = vos;
                GridCustomer.DataSource = vos;
                GridCustomer.DataBind();

                Session[this.GetType().ToString() + "MFAccountLists"] = GetMFAccountLists();
                cboAccountNo.DataSource = GetMFAccountLists();
                //cboAccountNo.ValueField = "AccountID";
                //cboAccountNo.TextField = "AccountNo";
                cboAccountNo.DataBind();
            }
        }

        if (!Page.IsCallback)
        {
            cbTest.ClientSideEvents.CallbackComplete = @"function(s, e) {
                this.MyResult=e.result;
	            "     + cbpTxtMFAccountNo.ClientInstanceName + @".PerformCallback();
            }";
            CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s, e) {
                this.MyResult=e.result;
                " + GridCustomer.ClientInstanceName + @".PerformCallback();
            }";

            btnFindName.ClientSideEvents.Click = @"function(s, e) {
                var a = " + txtFirstName.ClientInstanceName + @".GetText();
                if(a != '')
                    " + CallbacklikeCustomerName.ClientInstanceName + @".SendCallback();
            }";

            if (cboAccountNo.Buttons[0] != null)
            {
                cboAccountNo.ClientSideEvents.ButtonClick =
                    @"function(s,e)
                {
                    if(e.buttonIndex == 0)
                    {
                        var win = " + popupAccount.ClientInstanceName + @".GetWindow(0);
                        " + popupAccount.ClientInstanceName + @".ShowWindow(win);
                    }
                }";
            }
            ;
            IList <MFAccount_MFAccountControl_Vo> vos = (IList <MFAccount_MFAccountControl_Vo>)Session[this.GetType().ToString() + "GridMFAccount"];

            GridCustomer.ClientSideEvents.CustomButtonClick = @"function(s,e)
            {
                var buttonID = e.buttonID;
                var visibleIndex = parseInt(e.visibleIndex);
                  if(buttonID = 'buttonSelect')
                  {
                     " + GridCustomer.ClientInstanceName + @".GetRowValues(visibleIndex,'AccountID;AccountNo',
                           function (values)
                            {
                                " + lblMFCustomerName.ClientInstanceName + @".SetText(document.mfaccountMap[values[0]]);
                               for(var i = 0;i<" + vos.Count + @";i++){
                                    var id = " + cboAccountNo.ClientInstanceName + @".GetItem(i).value;
                                    if(parseInt(id)==parseInt(values[0])){
                                        " + cboAccountNo.ClientInstanceName + @".SetSelectedIndex(i);
                                         break;
                                    }
                                }
                                " + popupAccount.ClientInstanceName + @".Hide();
                            }
                        );
                  }
            }";
            btnViewSignature.Visible = this.showOwnerSignature;
            //game
            popupViewSignature.PopupElementID = btnViewSignature.ClientID;
            string ifPageForTransaction = "";
            if (isTransaction)
            {
                ifPageForTransaction = cbCheckOwner.ClientInstanceName + @".SendCallback();";
            }

            //game
            cbCheckOwner.ClientSideEvents.CallbackComplete = @"function(s, e){
                var a = e.result;
                if(a != ''){
                    //alert( a );
                    document.getElementById('" + tdIsEmployee.ClientID + @"').style.display = '';
                }else{
                    document.getElementById('" + tdIsEmployee.ClientID + @"').style.display = 'none';
                }
            }";

            cboAccountNo.ClientSideEvents.SelectedIndexChanged = @"function(s,e)
            {
                var value = s.GetValue();
                var str = document.mfaccountMap[s.GetValue()];
                " + lblMFCustomerName.ClientInstanceName + @".SetText(str);
                if(typeof(" + btnViewSignature.ClientInstanceName + @") != 'undefined')
                {
                    " + btnViewSignature.ClientInstanceName + @".SetVisible(str != '');
                    " + cbpViewSignature.ClientInstanceName + @".PerformCallback();
                }
                if(typeof(oncompleteLoadMFAccount) != 'undefined'){
                   oncompleteLoadMFAccount();
                }
                if(typeof(loadMFAccountFund) != 'undefined'){
                   loadMFAccountFund(" + cboAccountNo.ClientInstanceName + @".GetValue());
                }
                if(typeof(loadMFAccountBankAccount) != 'undefined'){
                   loadMFAccountBankAccount(" + cboAccountNo.ClientInstanceName + @".GetValue());
                }"
                                                                 + ifPageForTransaction
                                                                 + @"var name = str;
                " + ClientSideEvents.AfterSelectedChanged + @"
                //document.getElementById('trComboAccount').style.display = 'none';
                //document.getElementById('trCustomerName').style.display = '';
            }";

            lblMFCustomerName.ClientSideEvents.Click = @"function(s, e){
                //document.getElementById('trComboAccount').style.display = '';
                //document.getElementById('trCustomerName').style.display = 'none';
            }";

            cbTest.ClientSideEvents.CallbackComplete = @"function(s,e)
            {
                " + GridCustomer.ClientInstanceName + @".PerformCallback();
            }";

            String mfaccountMap = (String)Session["ctrls_MFAccountControlNew_mfaccounts"];
            cboAccountNo.ClientSideEvents.Init = @"function(s,e)
            {
                if(" + cboAccountNo.ClientInstanceName + @".GetItemCount()<=0){
                    " + cbTest.ClientInstanceName + @".SendCallback();
                }
                document.mfaccountMap = eval(" + mfaccountMap + @");
            }";

            btnViewSignature.ClientSideEvents.Init         = @"function(s,e)
            {
                document.getElementById('" + divBiewSignature.ClientID + @"').style.visibility = 'visible';
                if(typeof(" + btnViewSignature.ClientInstanceName + @") != 'undefined')
                    " + btnViewSignature.ClientInstanceName + @".SetVisible(" + lblMFCustomerName.ClientInstanceName + @".GetText() != '');
            }";
            btnViewSignature.ClientSideEvents.Click        = @"function(s,e)
            {
                " + popupViewSignature.ClientInstanceName + @".Show();
            }";
            cbpTxtMFAccountNo.ClientSideEvents.EndCallback = @"function(s,e)
            {
                if(typeof(s.cpResult) != 'undefined' && s.cpResult)
                {
                    " + lblMFCustomerName.ClientInstanceName + @".SetText('');
                    s.cpResult = null;
                }
            }";
        }
    }