protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument) { try { if (eventArgument == "Rebind") { IndCatGrid sourceGrid = (IndCatGrid)sourceControl; sourceGrid.SetPage(); } } catch (IndException ex) { ShowError(ex); return; } catch (Exception ex) { ShowError(new IndException(ex)); return; } base.RaisePostBackEvent(sourceControl, eventArgument); }
/// <summary> /// Override the OnLoad method and initialize the grid. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { try { base.OnLoad(e); //Get the moduleCode from the parent Ascx string moduleCode = _ParentGenericUserControl.ModuleCode; //Get the current user from session _currentUser = (CurrentUser)SessionManager.GetSessionValueRedirect(_ParentGenericUserControl.ParentPage, SessionStrings.CURRENT_USER); //The exception to the rule. ProjectCoreTeamMember is the only entity used with GenericViewControl for which the id of the project //is relevant if (EntityType == typeof(ProjectCoreTeamMember)) //|| (EntityType == typeof(WorkPackage))) { int idProject = SessionManager.GetCurrentProject(this.Page).Id; //Get the permisions from the current logged user this.ViewPermission = _currentUser.GetPermission(moduleCode, Operations.View, idProject); this.AddPermission = _currentUser.GetPermission(moduleCode, Operations.Add, idProject); this.EditPermission = _currentUser.GetPermission(moduleCode, Operations.Edit, idProject); this.DeletePermission = _currentUser.GetPermission(moduleCode, Operations.Delete, idProject); } else { //Get the permisions from the current logged user this.ViewPermission = _currentUser.GetPermission(moduleCode, Operations.View); this.AddPermission = _currentUser.GetPermission(moduleCode, Operations.Add); this.EditPermission = _currentUser.GetPermission(moduleCode, Operations.Edit); this.DeletePermission = _currentUser.GetPermission(moduleCode, Operations.Delete); } GenericGrid = new IndCatGrid(); if (this.ViewPermission == Permissions.None) { GenericGrid.Visible = false; throw new IndException(ApplicationMessages.EXCEPTION_NO_PERMISSION_TO_VIEW_PAGE); } GenericGrid.EntityType = _EntityType; GenericGrid.ViewPermission = ViewPermission; GenericGrid.UseAutomaticEntityBinding = true; GenericGrid.MasterTableView.TableLayout = GridTableLayout.Fixed; if (!_DataSourcePersistent) { GenericGrid.DataSourcePersistenceMode = GridDataSourcePersistenceMode.NoPersistence; } GenericGrid.ID = "grd"; Dictionary <string, int> currentPageDictionary; if ((currentPageDictionary = (Dictionary <string, int>)SessionManager.GetSessionValueNoRedirect(_ParentGenericUserControl.ParentPage, SessionStrings.PAGE_NUMBER_MAPPING)) != null) { GenericGrid.CurrentPage = currentPageDictionary[SessionManager.GetSessionValueRedirect(_ParentGenericUserControl.ParentPage, SessionStrings.VIEW_CONTROL).ToString()]; } //Get the ajax manger placed on the masterpage RadAjaxManager ajaxManager = ((IndBasePage)this.Page).GetAjaxManager(); //This web control will refresh itself, without refreshing the whole page ajaxManager.AjaxSettings.AddAjaxSetting(this, this); Panel pnlErrors = (Panel)this.Page.Master.FindControl("pnlErrors"); ajaxManager.AjaxSettings.AddAjaxSetting(this, pnlErrors); } catch (IndException ex) { _ParentGenericUserControl.ReportControlError(ex); return; } catch (Exception ex) { _ParentGenericUserControl.ReportControlError(new IndException(ex)); return; } }