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

template filtering

2 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ibrahim
Top achievements
Rank 1
ibrahim asked on 18 Mar 2009, 10:09 AM
hello all
i am trying to create a template to filter my radgrid i used this aspx code

    SortExpression="Technology" UniqueName="Technology">
                                    <FilterTemplate>
                        <telerik:RadComboBox ID="teck" runat="server" DataSourceid="teck_filter"  DataTextField="teck_Name" DataValueField="teck_Name"
                        AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Technology").CurrentFilterValue %>'
                         OnClientSelectedIndexChanged="SelectedIndexChanged" AutoPostBack="false" >
                        <Items>
                        <telerik:RadComboBoxItem></telerik:RadComboBoxItem>
                        </Items>
                        </telerik:RadComboBox>
                     <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function SelectedIndexChanged(sender,args) {
var tableView=$find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");
tableView.filter("Country",args.get_item().get_value(),"EqualTo");
}
</script>
</telerik:RadScriptBlock>
   
                       
                    </FilterTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TechnologyTextBox" runat="server" 
                            Text='<%# Bind("Technology") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="TechnologyLabel" runat="server" Text='<%# Eval("Technology") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
when i run the combo box apear but when i change the selected index nothing happens...
i thought about using the server side but the issue as u can see i have to edit it if not in this column then in others that i have to filter  using a combo box ...did i do anything wrong i followed the example exactly.. 

2 Answers, 1 is accepted

Sort by
0
ibrahim
Top achievements
Rank 1
answered on 18 Mar 2009, 10:10 AM
is it the entity datasource thing?? becasue i dont have it in my version of vs2008
0
Pavlina
Telerik team
answered on 20 Mar 2009, 04:12 PM
Hello Ibrahim,

If you are not using an EntityDatasource, you have to use server side code to set the filter expression for the grid control manually.  We have a GridBoundColumn, bound to a data source field called "CategoryName". We want, instead of using the default filter menu, to utilize a RadComboBox which should enable the end user to select an item from the combo, and have the grid display the relevant items.

For more information about how to use filter template, please refer to the following articles:
Filter template-help topic
Demo
New feature: ASP.NET AJAX grid filter template

I hope this helps.

Best wishes,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
ibrahim
Top achievements
Rank 1
Answers by
ibrahim
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or