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

Grid trying to bind to custom Filtering Template column

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sean Severson
Top achievements
Rank 1
Sean Severson asked on 09 Nov 2010, 05:25 PM
I'm following the demo for Grid/Filtering Template Columns and am able to create and add my custom filter column (with a dropdownlist for selecting the value) but when the bind occurs on the grid I am getting an error that indicates that the grid is attempting to bind data to the row containing the filtering control.

My FilteringTemplateColumn is almost exactly the same as in the demo, except for how the droplist is populated.  I'm using a generic dictionary to populate the droplist.   There error I am receiving is

Object of type System.Collections.Generic.KeyValuePair`2[System.String,System.String] does not have a CreatedBy.ID property.

 

CreatedBy.ID is the DataField property for my custom filtering template column and is also used in the template in a label control via an Eval("CreatedBy.ID")

<form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="FilterableRadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="FilterableRadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
  
        <telerik:RadGrid ID="FilterableRadGrid1" Width="97%" runat="server" GridLines="None" AllowFilteringByColumn="True" AutoGenerateColumns="False">
            <MasterTableView AllowFilteringByColumn="true" TableLayout="Fixed">
               <Columns>
                    <telerik:GridBoundColumn DataField="Created" HeaderText="Created" UniqueName="column"
                        AllowFiltering="true">
                    </telerik:GridBoundColumn>
                    <cc1:SICustomFilteringDropListColumn FilterControlWidth="180px" HeaderText="Created By"
                        FilterField="CreatedBy.ID" DataField="CreatedBy.ID">
                        <ItemTemplate>
                            <asp:Label ID="lblCreatedBy" runat="server"><%# Eval("CreatedBy.ID")%></asp:Label>
                        </ItemTemplate>
                    </cc1:SICustomFilteringDropListColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
   </div>
</form>

I'm sure I'm missing something simple.  Thank you for your help.

Sean M. Severson

1 Answer, 1 is accepted

Sort by
0
Sean Severson
Top achievements
Rank 1
answered on 10 Nov 2010, 01:42 PM
i was correct in thinking it was something simple, and dumb, I was missing.  In binding the list of values to the radComboBox I was trying to use the column name for DataTextfield and DataValueField instead of value and key (my datasource is a sorted dictionary).

Sean M. Severson.
Tags
Grid
Asked by
Sean Severson
Top achievements
Rank 1
Answers by
Sean Severson
Top achievements
Rank 1
Share this question
or