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

filter by enum value

1 Answer 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
adel emam
Top achievements
Rank 1
adel emam asked on 27 Apr 2010, 12:50 PM
I 've a Rad Grid with template filter which has drop down  , i want now to filter this column which contain a text that is generated in item data bound which contain the string value of the enum value , now i don't know how to do it

protected

 

 

void grdSensitivty_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

 

if (e.Item is GridDataItem)

 

{

 

 

///inject Confirmation Delete client message programatically ti show item name

 

 

 

var item = e.Item as GridDataItem;

 

 

 

 

 

(item.FindControl(

 

"lblEffective") as Label).Text = ((Sensitivity)e.Item.DataItem).Effective == true ? "Positive" : "Negative";

 

}
}

 

<

 

 

telerik:RadGrid ID="grdSensitivty" runat="server"

 

 

 

AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"

 

 

 

onneeddatasource="grdSensitivty_NeedDataSource"

 

 

 

ShowFooter="True" ShowGroupPanel="True"

 

 

 

 

 

 

 

AllowAutomaticDeletes="True" AllowAutomaticInserts="True"

 

 

 

AllowAutomaticUpdates="True"

 

 

 

AutoGenerateColumns="False"

 

 

 

 

 

 

 

OnDeleteCommand="grdSensitivty_DeleteCommand"

 

 

 

OnInsertCommand="grdSensitivty_InsertCommand"

 

 

 

OnUpdateCommand="grdSensitivty_UpdateCommand"

 

 

 

OnItemCommand="grdSensitivty_ItemCommand"

 

 

 

OnPdfExporting="grdSensitivty_PdfExporting"

 

 

 

OnItemCreated="grdSensitivty_ItemCreated"

 

 

 

OnItemDataBound="grdSensitivty_ItemDataBound"

 

 

 

OnGridExporting="grdSensitivty_GridExporting" Width="100%"

 

 

 

>

 

 

 

 

 

 

 

<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="true" Resizing-AllowRowResize="false" Resizing-AllowColumnResize="true" AllowRowsDragDrop="false" >

 

 

 

 

 

 

 

<Selecting AllowRowSelect="True" />

 

 

 

 

 

 

 

<Scrolling AllowScroll="false" UseStaticHeaders="True" />

 

 

 

 

 

 

 

</ClientSettings>

 

<

 

 

MasterTableView DataKeyNames="Id" CommandItemDisplay="TopAndBottom" RetrieveAllDataFields="false" AllowPaging="true" AllowSorting="true" PageSize="10" AutoGenerateColumns="false" AllowAutomaticInserts="false" AllowAutomaticUpdates="false" >

 

 

 

 

 

 

 

<CommandItemSettings

 

 

 

ShowExportToWordButton="true"

 

 

 

 

 

 

 

ShowExportToExcelButton="true"

 

 

 

ShowExportToPdfButton="false"

 

 

 

 

 

 

 

/>

 

 

 

 

 

 

 

 

 

<

 

 

Columns>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<

 

 

telerik:GridTemplateColumn HeaderText="Effictive" UniqueName="effectiveUniqueName" >

 

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

 

<asp:Label ID="lblEffective" runat="server" ></asp:Label>

 

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

 

<EditItemTemplate>

 

 

 

 

 

 

 

<asp:DropDownList runat="server" ID="ddlEffective">

 

 

 

 

 

 

 

</asp:DropDownList>

 

 

 

 

 

 

 

</EditItemTemplate>

 

 

 

 

 

 

 

<FilterTemplate>

 

 

 

 

 

 

 

<asp:DropDownList runat="server" ID="ddlEffectiveFilter" AutoPostBack="true" >

 

 

 

 

 

 

 

<asp:ListItem Text="Negative" Value="false"></asp:ListItem>

 

 

 

 

 

 

 

<asp:ListItem Text="Positive" Value="true"></asp:ListItem>

 

 

 

 

 

 

 

</asp:DropDownList>

 

 

 

 

 

 

 

</FilterTemplate>

 

</

 

 

telerik:GridTemplateColumn>

 

 

 

 

 

 

 

 

 

</

 

 

Columns>

 

 

 

 

 

 

 

<EditFormSettings >

 

 

 

 

 

 

 

 

<EditColumn ButtonType="ImageButton" InsertText="Add UOM" UpdateText="Update UOM"

 

 

 

 

 

 

 

UniqueName="EditCommandColumn1" CancelText="Cancel edit" >

 

 

 

 

 

 

 

</EditColumn>

 

 

 

 

 

 

 

 

</EditFormSettings>

 

 

 

 

 

<

 

 

RowIndicatorColumn>

 

<

 

 

HeaderStyle Width="20px" ></HeaderStyle>

 

</

 

 

RowIndicatorColumn>

 

 

 

 

 

<

 

 

ExpandCollapseColumn>

 

<

 

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

 

ExpandCollapseColumn>

 

</

 

 

MasterTableView>

 

 

 

 

 

 

 

 

 

<

 

 

HeaderContextMenu EnableAutoScroll="True"></HeaderContextMenu>

 

 

 

 

 

 

 

</telerik:RadGrid>


can anyone tell how to make drop down list filter the text value in this column
i tried use filterExpresion but i 've failed


thanks


 

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 28 Apr 2010, 05:15 PM
Hello adel,

You will find the required information along with a sample at the following blog post:
http://blogs.telerik.com/vladimirenchev/posts/08-12-03/new_feature_asp_net_ajax_grid_filter_template.aspx

In addition, do keep in mind that you need to set EnableLinqExpressions=false in order for the filtering to work with a column bound to an Enum type of object.

Hope it helps.

Regards,
Tsvetoslav
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
adel emam
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or