void Page_Load(object sender, EventArgs e) { this.Grid.SortCommand += new GridSortCommandEventHandler(Grid_SortCommand); this.Grid.PageSizeChanged += new GridPageSizeChangedEventHandler(Grid_PageSizeChanged); this.Grid.PageIndexChanged += new GridPageChangedEventHandler(Grid_PageIndexChanged); //this.Grid.ItemDataBound += new GridItemEventHandler(Grid_ItemDataBound); //this.Grid.PreRender += new EventHandler(Grid_PreRender); //this.SetupPage_Js(); if (this.IsPostBack) { this.mObjID = (string)this.ViewState[CnsObjID]; this.mProperties = (Control_GridList_Properties)this.ViewState[CnsProperties]; if (this.mProperties.IsPersistent) { this.mState = (Control_GridList_State)this.Session[this.mProperties.ModuleName]; } else { this.mState = (Control_GridList_State)this.ViewState[CnsState_GridList]; } /* if (this.mProperties.IsRequery) { this.mBase = (ClsBase)this.Session[CnsBase + this.mObjID]; } else { this.mDataSource = (DataTable)this.Session[CnsDataSource + this.mObjID]; } */ switch (this.mProperties.SourceType) { case eSourceType.Base: this.mBase = (Base)this.Session[CnsBase + this.mObjID]; break; case eSourceType.DataTable: this.mDataSource = (DataTable)this.Session[CnsDataSource + this.mObjID]; break; case eSourceType.Table: this.mTableName = (string)this.Session[CnsTableName + this.mObjID]; break; } } }
public void Setup( ClsSysCurrentUser CurrentUser , List<ClsBindGridColumn_Web_Telerik> BindDefinition = null , string Key = "" , bool AllowSort = false , bool AllowPaging = false , eSourceType SourceType = eSourceType.Base , Methods_Web_Telerik.eSelectorType SelectorType = Methods_Web_Telerik.eSelectorType.None , string ModuleName = "" , bool IsPersistent = true , bool IsBind = false) { if (SelectorType != Methods_Web_Telerik.eSelectorType.None && Key.Trim() == "") { throw new Exception("Key is required when using selectors."); } if (this.mObjID == null) { this.mCurrentUser = CurrentUser; this.mObjID = this.mCurrentUser.GetNewPageObjectID(); this.ViewState[CnsObjID] = this.mObjID; } this.mProperties = new Control_GridList_Properties(); this.ViewState[CnsProperties] = this.mProperties; this.mProperties.BindDefinition = BindDefinition; this.mProperties.Key = Key; this.mProperties.AllowSort = AllowSort; this.mProperties.AllowPaging = AllowPaging; //this.mProperties.IsRequery = IsRequery; this.mProperties.SourceType = SourceType; this.mProperties.SelectorType = SelectorType; this.mProperties.ModuleName = ModuleName != "" ? CnsState_GridList + ModuleName : CnsState_GridList + this.Page.Request.Url.AbsolutePath; this.mProperties.IsPersistent = IsPersistent; if (this.mProperties.IsPersistent) { this.mState = (Control_GridList_State)this.Session[this.mProperties.ModuleName]; if (this.mState == null) { this.mState = new Control_GridList_State(); this.Session[this.mProperties.ModuleName] = this.mState; } } else { this.mState = new Control_GridList_State(); this.ViewState[CnsState_GridList] = this.mState; } if (IsBind) { this.BindGrid(); } }