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

FilterTemplate - RadComboBox Default Value

2 Answers 84 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 18 Nov 2014, 09:51 AM
Hi,

I tried to set a default-Filter-Value in my FilterTemplate.
But my Default-Item doesn´t work as well... The filtering still shows "ALL" items

I need to set the default filter-value as "bearbeitung" (translation: in process)

With "<DefaultItem Text="Bearbeitung" Value="Bearbeitung"/>" it shows the correct value at the combobox.
But still shows all items.

If i choose the value "Bearbeitung" manually from the RadComboBox, the filtering works fine.

<telerik:GridBoundColumn AllowFiltering="true" FilterControlWidth="100px" DataField="TicketStatusBezeichnung" HeaderText="Ticket Status" ShowFilterIcon="true"  AutoPostBackOnFilter="true"><br>                    <FilterTemplate>
<
telerik:RadComboBox  ID="RadComboBoxTicketStatus" DataSourceID="SqlDataSource2" DataTextField="TicketStatusBezeichnung"<br>                            DataValueField="TicketStatusBezeichnung" Height="200px" AppendDataBoundItems="true"  SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("TicketStatusBezeichnung").CurrentFilterValue %>'<br>                            runat="server" OnClientSelectedIndexChanged="TitleIndexChanged" Sort="Descending"><br>                            <DefaultItem Text="Bearbeitung" Value="Bearbeitung"/><br>                            <Items><br>                                <telerik:RadComboBoxItem Text="Alle" /><br>                            </Items><br>                        </telerik:RadComboBox><br>                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"><br>                            <script type="text/javascript"><br>                                function TitleIndexChanged(sender, args) {<br>                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");<br>                                    tableView.filter("TicketStatusBezeichnung", args.get_item().get_value(), "EqualTo");<br>                                }<br>                            </script><br>                        </telerik:RadScriptBlock><br>                    </FilterTemplate><br>               
</
telerik:GridBoundColumn>

Thanks in advance :)

best,
Marc B

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 21 Nov 2014, 08:43 AM
Hi Marc,

In order to set a filter that will be applied initially to RadGrid you can use the following approach:

  • Handle the PreRender event of RadGrid
  • Use the handler to set the FilterExpression property
  • Rebind RadGrid

The approach is also illustrated in the article linked below.


Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Marc
Top achievements
Rank 1
answered on 25 Nov 2014, 07:02 AM
Thank you very much :)

It works fine ;)
Tags
Filter
Asked by
Marc
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Marc
Top achievements
Rank 1
Share this question
or