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

RadFilter attached to RadGrid with GenericList DataSource

5 Answers 160 Views
Filter
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 05 Apr 2010, 02:22 AM
I keep getting errors thrown when trying to use the RadFilter with a RadGrid

I'm binding the DS in Page_Load...

How should this be setup?


5 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 06 Apr 2010, 03:53 PM
Hi Steve,

Can you please verify that you are not databinding your RadGrid control on every page postback. Note that in order to take full advantage of RadFilter control integration you should consider using either Advanced Data-binding or declarative data-binding using a datasource control.

Kind regards,
Rosen
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 10 Apr 2010, 04:28 AM
Ok, I'm setting the DS in NeedsDataSource now

    protected void errorListView_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e) { 
        errorListView.DataSource = ErrorParser.Errors.OrderByDescending(x => x.Date); 
    } 


Server Error in '/' Application.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +78
   System.Collections.Generic.List`1.get_Item(Int32 index) +53
   Telerik.Web.UI.RadFilterItemsCollection.FindItemByHierarchicalIndex(String hierarchicalIndex) +307
   Telerik.Web.UI.RadFilterItemsCollection.get_Item(String hierarchicalIndex) +11
   Telerik.Web.UI.RadFilter.HandleClientCommand(String commandName, String commandArgs) +660
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981


Have a look at the attached screenshot, seems that the fields are duplicated...?


0
Rosen
Telerik team
answered on 12 Apr 2010, 08:19 AM
Hi Steve,

Can you please paste (using the format codeblock option) your page's declaration and code behind?

Sincerely yours,
Rosen
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 12 Apr 2010, 12:47 PM
    protected void errorListView_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e) { 
        if (searchBox.Text == null) { 
            errorListView.DataSource = ErrorParser.Errors.OrderByDescending(x => x.Date); 
        } else { 
            errorListView.DataSource = ErrorParser.Errors.Where(x => x.XmlResult().Contains(searchBox.Text)).OrderByDescending(x => x.Date); 
        } 
    } 


<telerik:RadFilter ID="filter" runat="server" FilterContainerID="errorListView" Skin="Black" /> 
<telerik:RadTextBox ID="searchBox" runat="server" EmptyMessage="search..." /><asp:Button ID="searchButton" runat="server" Text="search" /> 
 
<telerik:RadListView ID="errorListView" runat="server" EnableViewState="false"  
    onneeddatasource="errorListView_NeedDataSource"
    <ItemTemplate> 
    <div class="erroritem"
            <div class="errordetails"
                <h4 class="errorheader"><asp:LinkButton ID="LinkButton1" runat="server" Text='<%# DateTime.Parse(Eval("Date").ToString()).ToString("dddd MMMM dd, yyyy h:mm:ss tt") %>' EnableViewState="false" OnClientClick="return false;" /></h4
                <div class="errorbody"
                    <div class="list"
                        <h6>Application Information</h6> 
                        <%# GenerateList(Eval("ApplicationInformation"))%> 
                    </div> 
                    <div class="list"
                        <h6>Process Information</h6> 
                        <%# GenerateList(Eval("ProcessInformation"))%> 
                    </div> 
                    <div class="list"
                        <h6>Request Information</h6> 
                        <%# GenerateList(Eval("RequestInformation"))%> 
                    </div> 
                    <div class="list"
                        <h6>Variables</h6> 
                        <%# GenerateList(Eval("Variables"))%> 
                    </div> 
                    <div class="errorlevels"
                        <%# GenerateLevels(Eval("Errors"))%> 
                    </div> 
                </div> 
            </div> 
        </div> 
    </ItemTemplate> 
</telerik:RadListView> 

0
Accepted
Rosen
Telerik team
answered on 13 Apr 2010, 01:27 PM
Hi Steve,

Can you please enable the ViewState of the ListView and see if this makes any difference in the observed behavior.

Kind regards,
Rosen
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
Filter
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Rosen
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or