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

rad grid goes to need-datasource on paging

1 Answer 292 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rik butcher
Top achievements
Rank 1
rik butcher asked on 07 Jun 2013, 11:28 AM
hey guys, got an application that is stuffed full of  dozens of radgrids & i have one on a page that's doing some strange behavior.i've got a workaround but i'd like to get an expert opinion - not a link please - on this.
we have "stand alone filters" on all of our grids - not the column filters that are built in.
normal behavior seems to be - we use the breakout filter and when u page to the next page - it basically uses the contents of the grid. on this particular one - this one goes to need datasoure & ignores either the contents in the grid or the filtering that populated it.
i've pasted the mark-up if anyone can see why this is happening.
my workaround is in the need datasource itself. it looks to see if "filterexpression" == "" , if blank then does the fetch using the filter. worked like a charm but i'd love to know why this grid has that behavior.
thanks
rik

<telerik:RadGrid ID="TransferItemsRadGrid" runat="server" AllowPaging="true" AllowSorting="true"

                    PageSize="10" AutoGenerateColumns="false" Skin="WebBlue" OnItemDataBound="TransferItemsRadGrid_ItemDataBound"

                    OnNeedDataSource="TransferItemsRadGrid_NeedDataSource">

                    <ClientSettings EnableRowHoverStyle="true" />

                    <GroupingSettings CaseSensitive="false" />

                    <ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true" />

                    <MasterTableView DataKeyNames="WORKORDERNUMBER,LOCATIONID,WORKORDERID,WORKORDERDETAILID,MATERIALTYPEID,MATERIALDESCRIPTION,INVENTORYID,ITYPE"

                        CommandItemDisplay="TopAndBottom" CommandItemStyle-HorizontalAlign="Left">

                        <PagerStyle Mode="NextPrevNumericAndAdvanced" />

                        <CommandItemSettings ShowExportToExcelButton="true" ExportToExcelText="Export to Excel"

                            ShowAddNewRecordButton="false" />

                        <NoRecordsTemplate>

                            <div style="text-align: center; margin: 20px;">

                                There are no transfer items associated with this work order.

                            </div>

                        </NoRecordsTemplate>

                        <HeaderStyle HorizontalAlign="Left" />

                        <Columns>

                            <telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-Width="60px" UniqueName="OptionsMenuCell"

                                ItemStyle-HorizontalAlign="Left">

                                <ItemTemplate>

                                    <asp:Image ID="RecordInfoImage" runat="server" ImageUrl="~/App_Themes/GOLD Main/Images/grid_info.gif"

                                        CssClass="gridviewOptionsImage" />

                                    <telerik:RadToolTip ID="InfoRadToolTip" runat="server" TargetControlID="RecordInfoImage"

                                        Skin="Sunset" Position="MiddleRight" CssClass="gridviewToolTip" />

                                </ItemTemplate>

                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn DataField="WORKORDERITEMDISPLAY" HeaderText="WO Item #" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="ITYPE" HeaderText="Type" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="MATERIALTYPE" HeaderText="Material" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="STATUS_MESSAGE" HeaderText="Status" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="SIZEVALUE" HeaderText="Size" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="WEIGHTPERLENGTH" HeaderText="Weight" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="MATERIALGRADE" HeaderText="Grade" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="MATERIALTHREAD" HeaderText="Thread" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="MATERIALCOLORBAND" HeaderText="Color" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="MATERIALCOATING" HeaderText="Coating" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="MATERIALRANGE" HeaderText="Range" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="RACKNUMBER" HeaderText="Rack" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="ADJ_QTY" HeaderText="Inv Qty" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="ADJ_LENGTH" HeaderText="Length" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="OWNER_COMPANYNAME" HeaderText="Owner" AllowFiltering="false" />

                            <telerik:GridBoundColumn DataField="LOCATIONNAME" HeaderText="Division"  AllowFiltering="false" />

                        </Columns>

                    </MasterTableView>

                </telerik:RadGrid>

 

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 12 Jun 2013, 06:41 AM
Hi,

By design RadGrid fires NeedDataSource event each time when it pages to a new page. This is done in order for the control to take the needed data for the new page.

There should be no problem using RadGrid with NeedDataSource and RadFilter. Could you share your full page source code along with the code-behind file content? Thus all people who want to help you will have better understanding of your case.

Regards,
Andrey
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
rik butcher
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or