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

Filter not working

1 Answer 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 13 Oct 2010, 08:25 PM
Hello,
Filtering in a grid is not working for me. Possibly i'm missing a script, but when i filter, the page returns a blank grid. Here is my .aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm.aspx.cs" Inherits="Adroit_Sandbox.WebForm" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form runat="server" id="mainForm" method="post">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
    </Scripts>
    </telerik:RadScriptManager>
        <!-- content start -->
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1"   />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
 
            <telerik:RadCodeBlock runat="server" ID="radCodeBlock">
            <script type="text/javascript">
                function showFilterItem() {
                    $find('<%=RadGrid1.ClientID %>').get_masterTableView().showFilterItem();
                }
                function hideFilterItem() {
                    $find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
                }
            </script>
        </telerik:RadCodeBlock>
 
            <telerik:RadGrid
                ID="RadGrid1"
                OnSortCommand="RadGrid1_SortCommand"
                OnPageIndexChanged="RadGrid1_PageIndexChanged"
                Width="97%"
                OnPageSizeChanged="RadGrid1_PageSizeChanged"
                AllowFilteringByColumn="true"
                AllowSorting="True"
                PageSize="100"
                AllowPaging="True"
                AllowMultiRowSelection="True"
                runat="server"
             Height="700"
                Gridlines="None">
              <MasterTableView Width="100%" Summary="RadGrid table" /> 
              <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" FrozenColumnsCount="1">
                </Scrolling>
              </ClientSettings>
              <PagerStyle Mode="NextPrevAndNumeric" />
            </telerik:RadGrid>
        <!-- content end -->
    </form>
</body>
</html>

Help would be greatly appreciated!
Thanks
Pete

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 14 Oct 2010, 05:18 AM
Hello Pete,

 I assume that you are binding the grid in PageLoad event, which is Simple data binding technique. If you are using any advanced feature in grid(like filtering), then a better approach is using "AdvancedData binding" using NeedDataSource event.

For more information about this can be available here.
Advanced Data-binding (using NeedDataSource event)

Thanks,
Princy.
Tags
Grid
Asked by
Pete
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or