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

RadGrid filtering breaks when a column is bound to a bool

1 Answer 364 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 30 Mar 2010, 11:08 AM
Hi all,

I thought I'd post this here, in case it helps anyone else who gets as stuck as I did with this! I am using RadControls for ASP.NET AJAX Q3 2009.

I have a RadGrid using Filtering (AllowFilteringByColumn="True" EnableLinqExpressions="false") and declarative data binding with ObjectDataSource. I have several GridTemplateColumns, the final one is bound to a bool property on a business object. All looks fine until I try to filter any of the columns - when I do, no records are returned and the grid is empty.

I tracked this down to enabling filtering on the GridTemplateColumn bound to the boolean property. If I enable fitering on this particular column, no columns will filter and I get no records at all.  If I disable filtering on this column (see code below), filtering on the other columns works fine!!!

Fixed GridTemplateColumn:
                <telerik:GridTemplateColumn HeaderText="Enabled" DataField="Enabled" UniqueName="Enabled" SortExpression="Enabled" InitializeTemplatesFirst="false" ForceExtractValue="Always" AllowFiltering="false">  
                    <ItemTemplate> 
                        <%# (Boolean.Parse(Eval("Enabled").ToString())) ? "Yes" : "No" %> 
                     </ItemTemplate> 
                     <EditItemTemplate> 
                        <asp:CheckBox ID="chkEnabled" runat="server" Text="Enabled" Checked='<%# Bind("Enabled")%>'></asp:CheckBox> 
                      </EditItemTemplate> 
                </telerik:GridTemplateColumn> 

If anyone know of a fix, it would be great, if not, I hope this helps someone else out.

Anthony

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 02 Apr 2010, 09:23 AM
Hi Anthony,

Please refer to the following links for more details about filtering with Template Columns.
Implementing filtering for template/custom columns
Filtering Template Columns

I hope this gets you started properly.

Sincerely yours,
Pavlina
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
Grid
Asked by
Anthony
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or