Posted
on Jun 15, 2011
(permalink)
Hi,
we are dynamically binding PageSizeComboBox items inRadGrid1_ItemDataBound1 as bellow
protected void RadGrid1_ItemDataBound1(object sender, GridItemEventArgs e)
{
if (e.Item is GridPagerItem)
{
GridPagerItem pager = (GridPagerItem)e.Item;
Label lbl = (Label)pager.FindControl("ChangePageSizeLabel");
lbl.Visible = false;
RadComboBox combo = (RadComboBox)pager.FindControl("PageSizeComboBox");
combo.Style.Add("display","block");
combo.Items.Clear();
combo.Items.Add(new RadComboBoxItem("10", "10"));
combo.Items.Add(new RadComboBoxItem("20", "20"));
combo.Items.Add(new RadComboBoxItem("30", "30"));
combo.Items.Add(new RadComboBoxItem("40", "40"));
combo.Items.Add(new RadComboBoxItem("50", "50"));
combo.DataBind();
combo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(this.combo_SelectedIndexChanged);
combo.AutoPostBack = true;
combo.AccessibilityMode = true;
combo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
combo.ChangeTextOnKeyBoardNavigation = true;
}
}
void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadGrid1.PageSize = Convert.ToInt32(e.Value);
RadGrid1.Rebind();
}
<PagerStyle Mode="NextPrevAndNumeric" PagerTextFormat="{4} Page {0} from {1}, rows {2} to {3} from {5}" CssClass="Pager" AlwaysVisible="true" />
we are getting pager template both header and top; while clocking the PageSizeComboBox in top it is working fine. but Bottom of Radgrid ,PageSizeComboBox is not working, i need to set any property plsea help me out.
thanks in advance
v. venki