RadComboBox inside Grid PagerTemplate problem

3 posts, 1 answers
  1. Karen
    Karen avatar
    27 posts
    Member since:
    Jul 2008

    Posted 17 Nov 2008 Link to this post

    Hi all

    I have a RadComboBox placed inside the PagerTemplate of RadGrid

                                        <br /><br />
                                        <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                <td align="left">
                                                    Selected: &nbsp;
                                                    <telerik:RadComboBox ID="ActionBox" SkinID="NotFixed" runat="server">
                                                            <telerik:RadComboBoxItem Text="Delete" Value="1" />
                                                            <telerik:RadComboBoxItem Text="Mark as Read" Value="2" />
                                                            <telerik:RadComboBoxItem Text="Add to Black List" Value="3" />
                                                    <asp:Button ID="GoBtn" CssClass="SmallGreenBtn" OnClick="ActionGo_Clicked" runat="server" Text="Go" />
                                                <td align="right">
                                                    <asp:Panel runat="server" HorizontalAlign="Right" ID="NumericPagerPlaceHolder"></asp:Panel>

    And a button GoBtn which fires click event, I am getting the ComboBox from Pager using the following method

    private RadComboBox GetActionBox()
                GridItem pagerItem = InboxGrid.MasterTableView.GetItems(GridItemType.Pager)[0];
                RadComboBox ActionBox = (RadComboBox) pagerItem.FindControl("ActionBox");
                return ActionBox;

    It successfully finds the Combo but the selected value is always the first item's value in the Combo, I am stack with this and cannot move forward , any help is much appreciated.

    I also fire OnItemDataBound event to add the numeric pager, (just for more info)

    if (e.Item is GridPagerItem)
                    GridPagerItem gridPager = e.Item as GridPagerItem;
                    Control numericPagerControl = gridPager.GetNumericPager();
                    Control placeHolder = gridPager.FindControl("NumericPagerPlaceHolder");

    Data binding is done during the page load inside if(!IsPostBack)
  2. Answer
    Vlad avatar
    11100 posts

    Posted 18 Nov 2008 Link to this post

    Hello Karen,

    The easiest way to get the combo is with FindControl directly for the NamingContainer of the sender object in your button click event handler:

    RadComboBox ActionBox = (RadComboBox) ((Button)sender).NamingContainer.FindControl("ActionBox");

    Since there is a top (by default not visible) pager in the grid, this code:


    will return the top pager.

    Please try this and let me know about the result.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Karen
    Karen avatar
    27 posts
    Member since:
    Jul 2008

    Posted 18 Nov 2008 Link to this post

    Thank you so much Vlad, that helped me a lot, everything worked!
Back to Top