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

Filter Value Loss When change the pageIndex

1 Answer 26 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Selvamanikandan
Top achievements
Rank 1
Selvamanikandan asked on 25 Oct 2012, 12:34 PM
Hi All,

i lost the filter value when change the pageindex and all the values bind in radgrid.

here i have attached my code:

 <telerik:RadGrid ID="radAccountSearch" runat="server" AllowFilteringByColumn="true" ShowGroupPanel="true" GridLines="None"
                AllowPaging="true" AllowSorting="true" OnPreRender="radAccountSearch_PreRender"
                PageSize="9" DataSourceID="ldSource" Skin="Vista" AllowCustomPaging="true">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <MasterTableView TableLayout="Fixed">
                    <ItemTemplate>
                        <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %>
                        <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>'
                            runat="server">
                            <b>ID : </b>
                            <%# Eval("ID")%>
                            <b>Name : </b>
                            <%# Eval("Name")%>
                            <br />
                            <b>Company : </b>
                            <%# Eval("Company")%>
                            <br />
                            <b>Mobile : </b>
                            <%# Eval("Mobile")%>
                            <b>PhoneNo : </b>
                            <%# Eval("Phone")%>
                            <b>Status : </b>
                            <%# Eval("Status")%><br />
                            <b>Email Id : </b>
                            <%# Eval("Email")%>
                            <br />
                            <b>City : </b>
                            <%# Eval("City")%>
                            <b>State : </b>
                            <%# Eval("State")%>
                            <b>Country : </b>
                            <%# Eval("Country")%><br />
                            <b>Address: </b>
                            <%# Eval("Address")%>
                            <br />
                        </asp:Panel>
                    </ItemTemplate>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
                <HeaderStyle Font-Bold="false" />
            </telerik:RadGrid>
            <asp:LinqDataSource ID="ldSource" runat="server" ContextTypeName="Account.AssetDataContext"
                TableName="AccountContacts" OnSelecting="dsContact_Selecting">
            </asp:LinqDataSource>


below is my CS file.

protected void radAccountSearch_PreRender(object sender, EventArgs e)
    {
        int itemCount = (sender as RadGrid).MasterTableView.GetItems(GridItemType.Item).Length + (sender as RadGrid).MasterTableView.GetItems(GridItemType.AlternatingItem).Length;
        foreach (GridItem item in (sender as RadGrid).Items)
        {
           
            if (item is GridDataItem && item.ItemIndex < itemCount - 1)
            {
                ((item as GridDataItem)["ID"] as TableCell).Controls.Add(new LiteralControl("<table style='display:none;'><tr><td>"));
                                
            }  
            
        }
    }

please i need your help...please help me...

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 31 Oct 2012, 07:39 AM
Hi Selvamanikandan,

If you clear your browser cache this is an expected behaviour. However you could save the RadGrid settings by using GridSettingsPersister. That way you will be able to retrieve you filter values. For more information about GridSettingsPersister I suggest you take a look at the following help topic and this demo which demonstrates its usage.
In case this suggestion does not help I would suggest you to share the whole page markup as well as the related code behind so we could further investigate the issue and do our best to provide a proper solution.

All the best,
Angel Petrov
the Telerik team
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 their blog feed now.
Tags
Editor
Asked by
Selvamanikandan
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or