Hello,
I'm attempting to perform server side filtering on a RadGrid. I'm trying to follow your examples on filtering as well as some blog posts found here and here. On intial page load I load the Grid using a SQL data set. This loads fine. I then load filters for the status column of "All, Active, and Working". These values match exactly to what is returned in the data. When I click on the filter for the status column the server side event is called but the data is removed from the grid.
Can you tell me what I'm doing wrong?
thanks
pete
ASPX
CS
I'm attempting to perform server side filtering on a RadGrid. I'm trying to follow your examples on filtering as well as some blog posts found here and here. On intial page load I load the Grid using a SQL data set. This loads fine. I then load filters for the status column of "All, Active, and Working". These values match exactly to what is returned in the data. When I click on the filter for the status column the server side event is called but the data is removed from the grid.
Can you tell me what I'm doing wrong?
thanks
pete
ASPX
<rad:RadGrid id="RadGrid1" OnItemCreated="RadGrid1_ItemCreated" OnPreRender="RadGrid1_PreRender" OnItemCommand="RadGrid1_ItemCommand" ShowStatusBar="true" runat="server" AllowPaging="False" AllowSorting="True" AllowMultiRowSelection="True" AutoGenerateColumns="false" ClientSettings-Resizing-ResizeGridOnColumnResize="false" EnablePostBackOnRowClick="true" Width="100%" Height="92%" Skin="Windows7" AllowFilteringByColumn="true" EnableLinqExpressions="false"> <MasterTableView PageSize="10" Width="100%" TableLayout="Fixed" EnableViewState="false"> <Columns> <rad:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" HeaderStyle-Width="10%" HeaderStyle-HorizontalAlign="Center" AllowFiltering="false"> <HeaderTemplate> <asp:CheckBox id="headerChkbox" Text="Select All" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" runat="server"></asp:CheckBox> </HeaderTemplate> <ItemTemplate > <asp:CheckBox id="CheckBox1" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True" runat="server" Width="65"></asp:CheckBox> </ItemTemplate> </rad:GridTemplateColumn> <rad:GridBoundColumn DataField="DISCUSSION" DataType="System.String" HeaderText="Discussion" Visible="False" UniqueName="DISCUSSION"> <ItemStyle /> </rad:GridBoundColumn> <rad:GridBoundColumn DataField="KEY" DataType="System.String" HeaderText="ID" Visible="True" UniqueName="KEY" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false"> <ItemStyle /> </rad:GridBoundColumn> <rad:GridBoundColumn DataField="NAME" DataType="System.String" HeaderText="Name" UniqueName="NAME" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="40%" AllowFiltering="false"> <ItemStyle /> </rad:GridBoundColumn> <rad:GridBoundColumn DataField="STATUS" DataType="System.String" HeaderText="Status" UniqueName="STATUS" SortExpression="STATUS" ShowSortIcon="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="10%" AllowFiltering="true" AutoPostBackOnFilter="true" > <ItemStyle /> <FilterTemplate> <rad:RadComboBox ID="RadComboBoxStatus" OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged" DataTextField="STATUS" AutoPostBack="true" DataValueField="STATUS" Width="70px" runat="server" AppendDataBoundItems="true"> <Items> <rad:RadComboBoxItem Text="All" Value="All" /> <rad:RadComboBoxItem Text="Active" Value="Active"/>
<rad:RadComboBoxItem Text="Working" Value="Working" /> </Items> </rad:RadComboBox> </FilterTemplate> </rad:GridBoundColumn> </Columns> </MasterTableView> <ClientSettings EnableRowHoverStyle="true" Resizing-AllowColumnResize="true" Resizing-AllowRowResize="true" Resizing-EnableRealTimeResize ="false" Resizing-ResizeGridOnColumnResize="false" Resizing-ClipCellContentOnResize ="false"> <Scrolling AllowScroll ="true" UseStaticHeaders="true" /> <ClientEvents OnColumnResized="OnColumnResized" /> </ClientSettings> <PagerStyle Mode="Slider"></PagerStyle> </rad:RadGrid>CS
protected void FilterCombo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { string filterExpression; filterExpression = "([STATUS] = \'" + e.Text + "\')"; RadGrid1.MasterTableView.FilterExpression = filterExpression; RadGrid1.MasterTableView.Rebind(); }