problems with RadDataPager

2 posts, 0 answers
  1. john kennedy
    john kennedy avatar
    3 posts
    Member since:
    Apr 2010

    Posted 07 May 2010 Link to this post

    I using a RadDataPager with a list view, in the RadDataPager I have a RadComoBox that I want to load from Javascript. Can this be done my code is below. So I can’t get it to work.

     

    <telerik:RadDataPager ID="Pager1" runat="server" PagedControlID="dlResult" PageSize="5"

                                Width="698px">

                                <fields>

                                    <%--<telerik:RadDataPagerButtonField FieldType="FirstPrev" />--%>

                                    <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="5" />

                                    <%--<telerik:RadDataPagerButtonField FieldType="NextLast" />--%>

                                    <telerik:RadDataPagerPageSizeField PageSizeText="Page size:" />

                                    <telerik:RadDataPagerTemplatePageField>

                                        <PagerTemplate>

                                             <%--<div style="float: right; height:20px; padding: 0px 55px 5px 0px;">

                                               <telerik:RadToolBar ID="RadToolBar1" runat="server">

                                                    <Items>

                                                        <telerik:RadToolBarButton CommandName="Descending" PostBack="true" ImageUrl="../images/arrow1.png"    ToolTip="Sort in descending order" HoveredCssClass="rtbItemClicked" meta:resourcekey="btnDescendingResource1" />

                                                        <telerik:RadToolBarButton CommandName="Ascending" PostBack="true" ImageUrl="../images/arrow2.png"  HoveredCssClass="rtbItemClicked" ToolTip="Sort in ascending order" meta:resourcekey="btnAscendingResource1" />

                                                    </Items>

                                                 </telerik:RadToolBar>

                                             </div>--%>

                                             <div style="float: Left"> 

                                                <telerik:RadComboBox ID="ddSort1" OnSelectedIndexChanged="ddSort1_SelectedIndexChanged" OnClientSelectedIndexChanged="RadComboBoxOnClientSelected" AutoPostBack="true" runat="server" Width="95px" >

                                                     <%--<Items>

                                                        <telerik:RadComboBoxItem Text="Field to Sort" Value="" />

                                                        <telerik:RadComboBoxItem Text="Price" Value="Price" />

                                                        <telerik:RadComboBoxItem Text="Mileage" Value="Mileage" />

                                                        <telerik:RadComboBoxItem Text="Year" Value="VehicleYear" />

                                                          <telerik:RadComboBoxItem Text="Make" Value="VehicleMake" />

                                                        <telerik:RadComboBoxItem Text="Clear sort" Value="ClearSort" />

                                                    </Items>--%>

                                                </telerik:RadComboBox>

                                             </div>

                                             <div style="float: left; height:30px; padding: 0px 0px 0px 2px;">

                                               <telerik:RadToolBar ID="RadToolBar2" OnButtonClick="RadToolBar2_ButtonClick" Height="20px" AutoPostBack="true"  OnClientButtonClicking="onButtonClicked" runat="server">

                                                    <Items>

                                                        <telerik:RadToolBarButton CommandName="Sort" PostBack="true"  ImageUrl="../images/arrow1.png" Height="20px" Width="25" HoveredCssClass="rtbItemClicked" ToolTip="Sort in ascending order"  />

                                                        <telerik:RadToolBarButton CommandName="CompareChecked" PostBack="true" Text="Compare vehicles"  Height="20px" HoveredCssClass="rtbItemClicked" ToolTip="Compare checked vehicles" meta:resourcekey="btnCompareCheckedResource1" />

                                                        <telerik:RadToolBarButton CommandName="Download" PostBack="true" Text="Download"  Height="20px" ToolTip="Download" HoveredCssClass="rtbItemClicked" meta:resourcekey="btnExportResource1" />

                                                        <telerik:RadToolBarButton CommandName="EmailSearchResults" PostBack="true" Text="Email results"  Height="20px" HoveredCssClass="rtbItemClicked" ToolTip="Email search results" CheckOnClick="true"  meta:resourcekey="btnListViewResource1" />

                                                        <telerik:RadToolBarButton CommandName="GridView" PostBack="true" Text="List View"  Height="20px" HoveredCssClass="rtbItemClicked" ToolTip="Change to List View mode" meta:resourcekey="btnListViewResource1" />

                                                    </Items>

                                                 </telerik:RadToolBar>

                                             </div>

                                        </PagerTemplate>

                                    </telerik:RadDataPagerTemplatePageField>

                                </fields>

                            </telerik:RadDataPager>

     

     

    function GetSort(result, userContext, methodName)

             {

    var Pager = $find("<%# Pager1.ClientID %>");

                 var combo = Pager.findControl("ddSort1");

                 if (combo)

                  {

                    var comboItem = new Telerik.Web.UI.RadComboBoxItem();

                 combo.set_text("item");

                     combo.trackChanges();

                     combo.get_items().add(comboItem);

                     comboItem.select();

                     combo.commitChanges();

                 }

             }

     

                       

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 12 May 2010 Link to this post

    Hello john,

    In order to get reference to the RadComboBox in the RadDataPager, I would suggest you to handle the OnClientLoad client side event. There the sender is the RadComboBox. You can save it in a global variable and use it in the GetSort method later:

    var pagerCombo = null;
    function PagerComboClientLoad(sender, eventArgs)
    {
        pagerCombo = sender;
    }

    I hope this helps.

    Best wishes,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top