private void SetGridSize(int size) { GridPageSizeBLL TheBll = new GridPageSizeBLL(); string gridType = gridType = this.Parent.FindControl(AssociatedGridView).GetType().FullName; if (gridType == "System.Web.UI.WebControls.GridView") { GridView theGridView = (GridView)this.Parent.FindControl(AssociatedGridView); if (theGridView != null) { theGridView.PageSize = size; TheBll.SaveGridPageSizeState(AssociatedGridView.ToString(), HttpContext.Current.User.Identity.Name, size); } } //else if (gridType == "Telerik.Web.UI.RadGrid") //{ // RadGrid theTelerikGrid = (RadGrid)this.Parent.FindControl(AssociatedGridView); // if (theTelerikGrid != null) // { // theTelerikGrid.PageSize = size; // TheBll.SaveGridPageSizeState(AssociatedGridView.ToString(), // HttpContext.Current.User.Identity.Name, size); // } //} // now fire the event that tells the page that we changed the grid rows, so they can choose to // rebind if necessary EventArgs theEventArgs = new EventArgs(); OnGridRowsChanged(theEventArgs); }
protected void Page_Load(object sender, EventArgs e) { if (AssociatedGridView == null || AssociatedGridView.Length == 0) { this.Visible = false; return; } string gridType = gridType = this.Parent.FindControl(AssociatedGridView).GetType().FullName; switch (gridType) { //case "Telerik.Web.UI.RadGrid": // RadGrid theRadGrid = (RadGrid)this.Parent.FindControl(AssociatedGridView); // if (theRadGrid != null) // { // Rows3ImageButton.Visible = Rows3; // Rows5ImageButton.Visible = Rows5; // Rows10ImageButton.Visible = Rows10; // Rows20ImageButton.Visible = Rows20; // Rows30ImageButton.Visible = Rows30; // Rows50ImageButton.Visible = Rows50; // GridPageSizeBLL theBLL = new GridPageSizeBLL(); // GridPageSize theGridPageSize = theBLL.GetGridPageSizeState(AssociatedGridView.ToString(), // HttpContext.Current.User.Identity.Name); // if (theGridPageSize != null) // { // theRadGrid.PageSize = theGridPageSize.PageSize; // } // } // else // { // this.Visible = false; // } // break; case "System.Web.UI.WebControls.GridView": GridView theGridView = (GridView)this.Parent.FindControl(AssociatedGridView); if (theGridView != null) { Rows3ImageButton.Visible = Rows3; Rows5ImageButton.Visible = Rows5; Rows10ImageButton.Visible = Rows10; Rows20ImageButton.Visible = Rows20; Rows30ImageButton.Visible = Rows30; Rows50ImageButton.Visible = Rows50; GridPageSizeBLL theBLL = new GridPageSizeBLL(); GridPageSize TheGridPageSize = theBLL.GetGridPageSizeState(AssociatedGridView.ToString(), HttpContext.Current.User.Identity.Name); if (TheGridPageSize != null) { theGridView.PageSize = TheGridPageSize.PageSize; } } else { this.Visible = false; } break; default: this.Visible = false; break; } }