Created
June 3, 2014 14:51
-
-
Save adamgoucher/9fd885afd4921f32d936 to your computer and use it in GitHub Desktop.
radgrid hackiness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void RGsummary_ItemDataBound(object sender, GridItemEventArgs e) | |
{ | |
if (e.Item is GridPagerItem) | |
{ | |
//setting the page sizes | |
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox"); | |
BLL.RadGridFunctions.PopulatePageSizeCombo(PageSizeCombo, RGsummary.MasterTableView.ClientID); | |
PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true; | |
//Localization... | |
// - 'previous page', 'previous pages', 'next page', 'next pages' are settable in the actual aspx code | |
// - the string for 'n of x pages' or whatever is also settable there is a very specific syntax | |
// this is the blurb to the left of the combo box | |
Label ChangePageSizeLabel = (Label)e.Item.FindControl("ChangePageSizeLabel"); | |
ChangePageSizeLabel.Text = Resources.LanguageResource.RadGrid_ChangePageSizeLabel; | |
// you can't localise the first page or last page buttons through either the aspx configuration nor | |
// grabbing the control. sadly, this is the best way to do it, but is also highly dependent on the | |
// version of radgrid -- thus the switch | |
Button btnFirstPage; | |
Button btnLastPage; | |
switch (ConfigurationManager.AppSettings["TelerikVersion"]) | |
{ | |
case "2012.1.411.35": | |
btnFirstPage = (Button)e.Item.Controls[0].Controls[0].Controls[0].Controls[0].Controls[0].Controls[0]; | |
btnFirstPage.ToolTip = Resources.LanguageResource.RadGrid_FirstPage; | |
btnLastPage = (Button)e.Item.Controls[0].Controls[0].Controls[0].Controls[0].Controls[0].Controls[2]; | |
btnLastPage.ToolTip = Resources.LanguageResource.RadGrid_LastPage; | |
break; | |
case "2014.1.403.45": | |
btnFirstPage = (Button)e.Item.Controls[0].Controls[0].Controls[1].Controls[0].Controls[0].Controls[0]; | |
btnFirstPage.ToolTip = Resources.LanguageResource.RadGrid_FirstPage; | |
btnLastPage = (Button)e.Item.Controls[0].Controls[0].Controls[1].Controls[0].Controls[2].Controls[3]; | |
btnLastPage.ToolTip = Resources.LanguageResource.RadGrid_LastPage; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment