This is a migrated thread and some comments may be shown as answers.

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

2 Answers 13 Views
Grid
This is a migrated thread and some comments may be shown as answers.
liu
Top achievements
Rank 1
liu asked on 24 Aug 2015, 07:34 PM

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 Answers, 1 is accepted

Sort by
0
liu
Top achievements
Rank 1
answered on 24 Aug 2015, 07:46 PM

Added one more request.

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

Thank you.

0
Eyup
Telerik team
answered on 27 Aug 2015, 08:21 AM
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
Tags
Grid
Asked by
liu
Top achievements
Rank 1
Answers by
liu
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or