I have followed the example here to the letter:
http://www.telerik.com/help/aspnet-ajax/radgrid-filter-template.html
I have used the code-behind method since I am not using an EntityDataSource. However, it just doesn't work. After selecting a different item from the combobox it goes through the code to set the filter but then the combobox just gets reset to it's original value and nothing is filtered.
Here is my grid:
| <telerik:RadGrid ID="RadGridEmployeeTransactions" runat="server" |
| AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" |
| AutoGenerateColumns="False" GridLines="None" ShowGroupPanel="False" Width="620px" |
| EnableLinqExpressions="false"> |
| <HeaderContextMenu> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </HeaderContextMenu> |
| <PagerSTyle AlwaysVisible="true" Mode="NextPrevNumericAndAdvanced" /> |
| <MasterTableView> |
| <Columns> |
| <telerik:GridBoundColumn DataField="TransactionID" Groupable="False" |
| HeaderText="ID" ReadOnly="True" SortExpression="TransactionID" |
| UniqueName="TransactionID" |
| FilterControlWidth="50px"> |
| <HeaderStyle HorizontalAlign="Center" Width="70px" /> |
| <ItemStyle HorizontalAlign="Center" Width="70px" /> |
| </telerik:gridboundcolumn> |
| <telerik:GridBoundColumn DataField="DateSubmitted" Groupable="True" |
| HeaderText="Date Submitted" ReadOnly="True" SortExpression="DateSubmitted" |
| UniqueName="DateSubmitted" GroupByExpression="DateSubmitted" > |
| <HeaderStyle HorizontalAlign="Left" Width="130px" /> |
| <ItemStyle HorizontalAlign="Left" Width="130px" /> |
| <FilterTemplate> |
| <telerik:RadComboBox ID="RadComboboxDateSubmittedFilter" |
| runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadComboboxDateSubmittedFilter_SelectedIndexChanged"> |
| <Items> |
| <telerik:RadComboBoxItem Value="2009" Text="2009" /> |
| <telerik:RadComboBoxItem Value="2008" Text="2008" /> |
| </Items> |
| </telerik:RadComboBox> |
| </FilterTemplate> |
| </telerik:gridboundcolumn> |
| <telerik:GridBoundColumn DataField="Tooltip" Groupable="True" |
| HeaderText="Transaction Type" ReadOnly="True" SortExpression="Tooltip" |
| UniqueName="Tooltip" GroupByExpression="Tooltip" |
| FilterControlWidth="200px"> |
| <HeaderStyle HorizontalAlign="Left" Width="250px" /> |
| <ItemStyle HorizontalAlign="Left" Width="250px" /> |
| </telerik:gridboundcolumn> |
| <telerik:GridBoundColumn DataField="Status" Groupable="True" |
| HeaderText="Transaction Type" ReadOnly="True" SortExpression="Status" |
| UniqueName="Status" GroupByExpression="Status" |
| FilterControlWidth="100px"> |
| <HeaderStyle HorizontalAlign="Left" Width="150px" /> |
| <ItemStyle HorizontalAlign="Left" Width="150px" /> |
| </telerik:gridboundcolumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings AllowDragToGroup="True"> |
| </ClientSettings> |
| <FilterMenu> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </FilterMenu> |
| </telerik:RadGrid> |
| Public Sub RadComboboxDateSubmittedFilter_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) |
| Dim lBeginDate As String = "1/1/" & e.Value + " 12:00:00 AM" |
| Dim lEndDate As String = "12/31/" & e.Value + " 11:59:59 PM" |
| Dim lFilterExpression As String = String.Format(CultureInfo.CurrentCulture, "([DateSubmitted] BETWEEN '{0}' AND '{1}'", lBeginDate, lEndDate) |
| RadGridEmployeeTransactions.MasterTableView.FilterExpression = lFilterExpression |
| RadGridEmployeeTransactions.MasterTableView.Rebind() |
| End Sub |
I'm using an older version of the RadGrid control - r.a.d.controlsQ3 2006 - v2.0.50727 and I'm trying to use OnitemDataBound to create some hyper links in my columns when my grid is loading. But I don't seem to have access to the GridDataItem and I'm unsure what namespace to import to get the code below to compile. Is there a different way to go about this with the older version of the grid control I'm using?
protected void gridDataFeed_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e)
{
if (e.Item is Telerik.WebControls.GridDataItem)
{
GridDataItem dataItem = e.Item as GridDataItem;
//CODE wil be implemented here to update the item
}
}
Any help would be greatly appreciated.
Thanks
Todd