Error with RadFilter in RadWindow

5 posts, 1 answers
  1. Marc St-Laurent
    Marc St-Laurent avatar
    3 posts
    Member since:
    Apr 2010

    Posted 01 Apr 2010 Link to this post

    Hello,

    I have a page that contains a RadGrid, and I would like to be able to open a RadWindow which contains a RadFilter for the grid.  My current implementation has all 3 objects on the same page (Default.aspx).  The RadWindow does not open a new URL, instead it contains the RadFilter in a ContentTemplate declaration:

    <!-- The window opened by the "Filter Builder" toolbar button --> 
        <telerik:RadAjaxPanel runat="server" ID="WindowAjaxPanel"
            <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" 
                    runat="server" Skin="Office2007"
                <Windows> 
                    <telerik:RadWindow ID="FilterBuilderWindow" runat="server" Behaviors="Close" Title="Filter Builder" 
                            Width="350" Height="350" EnableViewState="true"
                        <ContentTemplate> 
                            <asp:Panel ID="FilterContentPanel" runat="server" CssClass="filterDialogContent"
                                <asp:Panel ID="FilterPanel" runat="server" CssClass="filterTree"
                                    <telerik:RadFilter runat="server" ID="FilterControl" RegisterWithScriptManager="true" 
                                            FilterContainerID="OrderFulfillmentGrid" 
                                            ShowApplyButton="false" Skin="Office2007"/> 
                                </asp:Panel> 
                                <asp:Panel ID="FilterButtonPanel" runat="server" CssClass="filterButtonPanel"
                                    <asp:Button runat="server" ID="filterBuilderOK" OnClick="filterBuilderOK_Click" Text="OK" /> 
                                    <asp:Button runat="server" ID="filterBuilderCancel" Text="Cancel" 
                                            OnClick="filterBuilderCancel_Click" /> 
                                    <asp:Button runat="server" ID="filterBuilderApply" OnClick="filterBuilderApply_Click" 
                                            Text="Apply" /> 
                                </asp:Panel> 
                            </asp:Panel> 
                        </ContentTemplate> 
                    </telerik:RadWindow> 
                </Windows> 
            </telerik:RadWindowManager> 
        </telerik:RadAjaxPanel> 

    The RadWindow is opened with the following javascript:
    // Open the Filter Builder dialog 
    function openFilterBuilderDialog() { 
        window.radopen(null"FilterBuilderWindow"); 
        return false

    The window opens just fine, and the RadFilter appears normally.  The problem is that as soon as I press the "Add expression" button on the RadFilter, the following error is thrown:
    Erreur du serveur dans l'application '/'. 
    -------------------------------------------------------------------------------- 
     
    L'index était hors limites. Il ne doit pas être négatif et doit être inférieur à la taille de la collection. 
    Nom du paramètre : index  
    Description : Une exception non gérée s'est produite au moment de l'exécution de la demande Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code.  
     
    Détails de l'exception: System.ArgumentOutOfRangeException: L'index était hors limites. Il ne doit pas être négatif et doit être inférieur à la taille de la collection. 
    Nom du paramètre : index 
     
    Erreur source:  
     
    Une exception non gérée s'est produite lors de l'exécution de la demande Web actuelle. Les informations relatives à l'origine et l'emplacement de l'exception peuvent être identifiées en utilisant la trace de la pile d'exception ci-dessous.   
     
    Trace de la pile:  
     
     
    [ArgumentOutOfRangeException: L'index était hors limites. Il ne doit pas être négatif et doit être inférieur à la taille de la collection. 
    Nom du paramètre : index] 
       System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +64 
       System.ThrowHelper.ThrowArgumentOutOfRangeException() +15 
       System.Collections.Generic.List`1.get_Item(Int32 index) +7497276 
       Telerik.Web.UI.RadFilterDataFieldEditorCollection.System.Collections.Generic.IList<Telerik.Web.UI.RadFilterDataFieldEditor>.get_Item(Int32 index) +41 
       Telerik.Web.UI.RadFilterDataFieldEditorCollection.get_Item(Int32 index) +37 
       Telerik.Web.UI.RadFilter.AddChildExpression(RadFilterGroupExpressionItem groupItem, Boolean isGroup) +121 
       Telerik.Web.UI.RadFilterCommandEventArgs.ExecuteCommand(Object source) +279 
       Telerik.Web.UI.RadFilter.OnBubbleEvent(Object source, EventArgs args) +196 
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
       Telerik.Web.UI.RadFilterExpressionItem.OnBubbleEvent(Object source, EventArgs args) +113 
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
       System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118 
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135 
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 
     
      
     
    Translation of the error message: The index was out of bounds.  It cannot be negative, and must be less than the size of the collection.  Parameter name: index.

    I have tried too many variations on the above code to count, and I'm all out of ideas.  Your help is greatly appreciated.
    Thanks in advance,
    Marc
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 06 Apr 2010 Link to this post

    Hello Marc,

    For your convenience I am attaching sample application demonstrating how to filter RadGrid using RadFilter when it is placed inside RadWindow.

    All the best,
    Nikolay
    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. Marc St-Laurent
    Marc St-Laurent avatar
    3 posts
    Member since:
    Apr 2010

    Posted 06 Apr 2010 Link to this post

    Hello,

    Thank you very much for your assistance.  I modified my code with the help of the example you sent, but the error persisted.  I figured it out, though.  It was caused by the fact that the grid and the window were not declared inside the same Content tag.  Once I moved them together, all started working.

    I did notice one little thing though: When I click on the "Add expression" button the first time, the click does register, but nothing seems to happen.  It does work on the 2nd click.  Have there been any reports of this kind of behavior?

    Thanks,
    Marc
  5. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 12 Apr 2010 Link to this post

    Hello Marc St-Laurent,

    Unfortunately when placing the controls in different ContentPlaceHolder is not supported as ContentPlaceHolders are naming containers. You can experience same behavior by placing some bound control(GridView/ListView) in one place holder and its DataSourceControl into another place holder.

    Regarding the second beahvior you should not use RadWindowManager when using ContentTemplate and RadAjaxManager. For more details please refer to the description on the demo bellow:
    http://demos.telerik.com/aspnet-ajax/window/examples/internalcontent/defaultcs.aspx

    All the best,
    Nikolay
    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. Marc St-Laurent
    Marc St-Laurent avatar
    3 posts
    Member since:
    Apr 2010

    Posted 12 Apr 2010 Link to this post

    Thank you for your help Nikolay.  Everything is working now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017