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

Filter on Grid Template Column with Expression?

1 Answer 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Farhan
Top achievements
Rank 1
Farhan asked on 25 Jan 2012, 08:38 PM
Hi,
   I have been trying to get this to work and need some help, I have a grid Template Column and have an expression to evaluate boolean values if its true or false in the Item Template, I need to filter on these values, how can I do this? In other Itemtemplate examples I have seen recommentdations to use Datafield but If i
use the
Datafield = "IsPrivateBank" ....it takes away the Filter from column header and just leaves a checkbox, since its taking it as a boolean value

and If I use the Expression in the datafield like

DataField = "<%# Convert.ToBoolean(Eval("IsPrivateBank")) == false ? "Federal" : "Private" %>"

this results in an error too. How can I filter on the values the user sees i.e "Federal" or "Private"  Please provide code example with your help, thanks in advance!!



<telerik:GridTemplateColumn HeaderText="Type" HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom" ItemStyle-HorizontalAlign="Left" SortExpression="IsPrivateBank">   
    <ItemTemplate>   
        <asp:Label ID="lblBankType" runat="server" Text='<%# Convert.ToBoolean(Eval("IsPrivateBank")) == false ? "Federal" : "Private" %>'></asp:Label>   
    </ItemTemplate>   
</telerik:GridTemplateColumn>  

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 26 Jan 2012, 05:43 PM
Tags
Grid
Asked by
Farhan
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or