Filter Value Loss When change the pageIndex

2 posts, 0 answers
  1. Selvamanikandan
    Selvamanikandan avatar
    4 posts
    Member since:
    Oct 2012

    Posted 25 Oct 2012 Link to this post

    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">
                            <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %>
                            <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>'
                                <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 />
                    <GroupingSettings CaseSensitive="false" />
                    <HeaderStyle Font-Bold="false" />
                <asp:LinqDataSource ID="ldSource" runat="server" ContextTypeName="Account.AssetDataContext"
                    TableName="AccountContacts" OnSelecting="dsContact_Selecting">

    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...
  2. Angel Petrov
    Angel Petrov avatar
    1154 posts

    Posted 31 Oct 2012 Link to this post

    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.
Back to Top