RadFilter attached to RadGrid with GenericList DataSource

6 posts, 1 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 04 Apr 2010 Link to this post

    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?


  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 06 Apr 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Apr 2010 Link to this post

    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...?


  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 12 Apr 2010 Link to this post

    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.
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Apr 2010 Link to this post

        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> 

  7. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 13 Apr 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017