Exemplo n.º 1
0
        public void BindApplicationData()
        {
            BuisnessApplicationSetting objBuisnessApplicationSetting = new BuisnessApplicationSetting();
            ApplicationSettingData     objApplicationSettingData     = new ApplicationSettingData();

            if (objBuisnessApplicationSetting.GetApplicationSettingData(ref objApplicationSettingData) == true)
            {
                dgApplicationSetting.DataSource = objApplicationSettingData.Tables[ApplicationSettingData.TABLE_APPLICATIONSETTING].DefaultView;
                dgApplicationSetting.DataBind();

                ViewState.Add("ApplicationData", objApplicationSettingData);
            }
        }
Exemplo n.º 2
0
        protected void dgApplicationSetting_SortCommand(object source, DataGridSortCommandEventArgs e)
        {
            //SortField = (string)e.SortExpression;
            if (ViewState["LastSortField"].ToString() == "NA")
            {
                SortField = e.SortExpression + " ASC";
                ViewState["LastSortField"] = e.SortExpression;
                ViewState["LastSortOrder"] = "ASC";
            }
            else if (e.SortExpression == ViewState["LastSortField"].ToString())
            {
                if (ViewState["LastSortOrder"].ToString() == "ASC")
                {
                    SortField = e.SortExpression + " DESC";
                    ViewState["LastSortOrder"] = "DESC";
                }
                else
                {
                    SortField = e.SortExpression + " ASC";
                    ViewState["LastSortOrder"] = "ASC";
                }
            }
            else
            {
                SortField = e.SortExpression + " ASC";
                ViewState["LastSortField"] = e.SortExpression;
                ViewState["LastSortOrder"] = "ASC";
            }
            BuisnessApplicationSetting objBuisnessApplicationSetting = new BuisnessApplicationSetting();
            ApplicationSettingData     objApplicationSettingData     = new ApplicationSettingData();

            if (objBuisnessApplicationSetting.GetApplicationSettingData(ref objApplicationSettingData) == true)
            {
                DataView objDataView = new DataView(objApplicationSettingData.Tables[ApplicationSettingData.TABLE_APPLICATIONSETTING]);
                objDataView.Sort = SortField;
                dgApplicationSetting.DataSource = objDataView;
                dgApplicationSetting.DataBind();
            }
        }