RadFilter with RadGrid. fieldName is null

2 posts, 0 answers
  1. ashraf al-safoo
    ashraf al-safoo avatar
    1 posts
    Member since:
    Sep 2009

    Posted 04 Aug 2011 Link to this post

    Hi Telerik,

    I have a radfilter pointed to a radgrid, the columns of radgrid gets created dynamically.
    i get error when i click on AddExpression

    [ArgumentException: Parameter cannot be null or empty. Parameter name: fieldName] Telerik.Web.UI.RadFilterDataFieldEditorCollection.FindEditorForFieldName(String fieldName) +242 Telerik.Web.UI.RadFilterSingleExpressionItem.SetupFunctionInterface(Control container) +61 Telerik.Web.UI.RadFilter.CreateFilterItems() +420 Telerik.Web.UI.RadFilter.CreateControlHierarchy() +65 System.Web.UI.Control.EnsureChildControls() +146 Telerik.Web.UI.RadFilter.AddChildExpression(RadFilterGroupExpressionItem groupItem, Boolean isGroup) +338 Telerik.Web.UI.RadFilterCommandEventArgs.ExecuteCommand(Object source) +173 Telerik.Web.UI.RadFilter.OnBubbleEvent(Object source, EventArgs args) +186 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 Telerik.Web.UI.RadFilterExpressionItem.OnBubbleEvent(Object source, EventArgs args) +131 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981


     

    <telerik:RadFilter runat="server" ID="RadFilter" 
                                ShowApplyButton="true" Visible="false" FilterContainerID="RadGrid"/>


    <telerik:RadGrid ID="RadGrid" runat="server" GridLines="None" AllowAutomaticUpdates="True" OnColumnCreated="RadGrid_ColumnCreated"
                                 ViewStateMode="Enabled" OnItemCommand="RadGrid_ItemCommand" OnItemDataBound="RadGrid_ItemDataBound" >             
                                <ExportSettings HideStructureColumns="true" />
                                <MasterTableView TableLayout="Fixed" RetrieveDataTypeFromFirstItem="true"
                                    CommandItemDisplay="Top" >
                                    <Columns>
                                        <telerik:GridTemplateColumn UniqueName="ImageFile" HeaderText="" Visible="false" >
                                            <ItemTemplate>
                                                <asp:Image ID="StatusImage" BorderWidth="0px" AlternateText="Status" runat="server"
                                                    Visible="true" />
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" Visible="false" />
                                    </Columns>
                                    <CommandItemSettings ShowExportToExcelButton="false" ShowAddNewRecordButton="false" ShowRefreshButton="false"/>
                                </MasterTableView>
                                <ClientSettings>
                                    <Selecting AllowRowSelect="True"></Selecting>
                                    <Scrolling AllowScroll="false"></Scrolling>
                                    <ClientMessages DragToGroupOrReorder="Drag to group" />
                                </ClientSettings>
                                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                                </HeaderContextMenu>
                            </telerik:RadGrid>

     

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Aug 2011 Link to this post

    Hello Ashraf,

    I suppose this issue arises because RadGrid does not support mixing declarative grid columns with grid columns added dynamically at runtime. You should either create all the columns in the grid programmatically, or else define them all in the ASPX file. Check the following help documentation which explains more about this.
    Programmatic Creation.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top