I have a radgrid with a column that has a RADCOMBO set in the filter Template. How do I set the the default filter index of the RADCOMBO on first time page load to another index programatically (in my case "Show Only Null" as opposed to "ALL"). I tried this code in both preRender and itemDataBound but it only sets the text and does not actually filter the data. The second part of the code shows the set up of the column in the aspx file. Can you provide me exact code? Thanks!
//tried this in preRender and itemDataBound methods
GridFilteringItem filterItem = (GridFilteringItem)e.Item;
RadComboBox combo = (RadComboBox)filterItem.FindControl("PROB_DATE");
combo.SelectedIndex = 1;
<telerik:GridBoundColumn ForceExtractValue="Always" DataField="PROB_DATE" ReadOnly="True" DataType="System.DateTime"
FilterControlAltText="Filter PROB_DATE column" HeaderText="PROB DATE RESOLVED"
SortExpression="PROB_DATE" UniqueName="PROB_DATE" DataFormatString="{0:MM/dd/yyyy}">
<FilterTemplate>
<telerik:RadComboBox ID="RadComboBoxPROB_DATE" DataSourceID="SqlDataSourceMyDataSource"
DataTextField="PROB_DATE" DataValueField="PROB_DATE" Height="200px" AppendDataBoundItems="true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("PROB_DATE").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="PROB_DATEIndexChanged" Width="140px">
<Items>
<telerik:RadComboBoxItem Text="ALL" />
</Items>
</telerik:RadComboBox>
<telerik:RadScriptBlock ID="RadScriptBlockPROB_DATE" runat="server">
<script type="text/javascript">
function PROB_DATEIndexChanged(sender, args) {
var value2 = args.get_item().get_value();
if (value2 == 'Show Only Null') {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("PROB_DATE", args.get_item().get_text(), "IsNull");
}
else {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("PROB_DATE", args.get_item().get_value(), "NoFilter");
}
//}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
</telerik:GridBoundColumn>