Esempio n. 1
0
        private void SetGridFormat(clsGridView gv)
        {
            gv.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
            gv.Refresh();

            ObjectContext oc;

            oc = ((IObjectContextAdapter)db).ObjectContext;
        }
Esempio n. 2
0
        public void BindGridData <T>(IEnumerable <T> result, clsGridView gv)
        {
            if (!(gv.Columns.Count > 0))
            {
                gv.Columns.Clear();
                gv.AutoGenerateColumns = false;
                gv.AllowUserToAddRows  = false;
                gv.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.None;

                try
                {
                    List <tblAppColumns> properties = (from col in db.tblAppColumns
                                                       where col.NAVID == gv.NAVID &&
                                                       col.APC_Grid == gv.Name &&
                                                       col.APC_Deleted == null
                                                       orderby col.APC_Order
                                                       select col).ToList <tblAppColumns>();


                    foreach (var property in properties)
                    {
                        clsGridUtil.AddColumns(gv, this.tblNav.NAVID, property, db, this.APPID, this.APPID, this.Associate.ASID);
                    }
                }
                catch (Exception ex)
                {
                }
            }

            try
            {
                gv.DataSource = null;
                //bs1.DataSource = result;
                gv.DataSource = result;

                clsGridUtil.SetGridColor(gv);

                clsGridUtil.SetGridRowHeight(gv);

                //clsGridUtil.EncryptCol(gv);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.AppName);
                return;
            }
        }