How to show filter row without providing data source when first time the paging is loading.

3 posts, 0 answers
  1. liu
    liu avatar
    3 posts
    Member since:
    Aug 2015

    Posted 24 Aug 2015 Link to this post

    Hi Team,

           I am using RadGrid, and the original implementation is good.

        However, my project manager wants to change the design to--> "showing the filter row without providing data source when first time the page is loading".

        That means, when users visit this page and the page is loading, I will skip the data binding step, but need to show the filter row in MasterTableView.

        My RadGrid is like the following one in ASPX page:

    <telerik:RadGrid ID="RadGridHotels" runat="server" AllowPaging="True" AllowCustomPaging="True"
                            AllowSorting="True" AllowFilteringByColumn="True" EnableLinqExpressions="True"
                            Width="100%" EnableEmbeddedBaseStylesheet="False" EnableEmbeddedSkins="false" Skin="Bootstrap" AutoGenerateColumns="False"
                            GridLines="None" OnNeedDataSource="RadGridHotels_NeedDataSource" OnItemCreated="RadGridHotels_ItemCreated"
                            OnPreRender="RadGridHotels_PreRender" OnItemDataBound="RadGridHotels_ItemDataBound"  OnItemCommand="RadGridHotels_ItemCommand">

                            <MasterTableView IsFilterItemExpanded="True" EditMode="InPlace" CommandItemDisplay="None"
                        DataKeyNames="Id" ClientDataKeyNames="Id" PagerStyle-AlwaysVisible="True"
                                OverrideDataSourceControlSorting="true" AllowNaturalSort="false" AllowCustomSorting="True"
                                PageSize="50">
                                <Columns>
                                    <telerik:GridBoundColumn DataType="System.Int32" ItemStyle-CssClass="UseHand first-column" HeaderText="Id" 
                                DataField="Id" UniqueName="Id" AutoPostBackOnFilter="true" 
                                SortExpression="Id" ShowFilterIcon="false" CurrentFilterFunction="EqualTo">
                                        <HeaderStyle Font-Bold="True" CssClass="rgHeader rgSortable" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn HeaderText="Display Name" ItemStyle-CssClass="UseHand clickElement column" FilterControlWidth=""
                                        UniqueName="DisplayName" DataField="DisplayName" AutoPostBackOnFilter="true"
                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" SortExpression="DisplayName">
                                        <HeaderStyle Font-Bold="True" CssClass="rgHeader rgSortable" /></telerik:GridBoundColumn>

        </Columns>​

     </MasterTableView>

    </telerik:RadGrid>​

     

               Please advise.

                Thank you.

  2. liu
    liu avatar
    3 posts
    Member since:
    Aug 2015

    Posted 24 Aug 2015 in reply to liu Link to this post

    Added one more request.

    The header of MasterTableView should show up with filter row when the page is first time loading.

    Thank you.

  3. Eyup
    Admin
    Eyup avatar
    3666 posts

    Posted 27 Aug 2015 Link to this post

    Hi Liu,

    In that case you can create an empty data source mimicking your original source and set it as the grid DataSource on initial load:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-binding/understanding-data-binding/server-side-binding/advanced-data-binding-%28using-needdatasource-event%29

    Also make sure that the following property is enabled:
    <MasterTableView ... ShowHeadersWhenNoRecords="true">

    If you need to change the columns structure dynamically, you can check the following article:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/changing-the-grid-structure-dynamically-on-postback

    Hope this helps.

    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top