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

Filter doesnt work

2 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 14 Jun 2012, 10:15 PM
I've done a bunch of grids with filters but I can't figure out why this one doesnt work, the grid will not filter

telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" GridLines="None"
    OnItemCommand="RadGrid1_ItemCommand" OnItemCreated="RadGrid1_ItemCreated" Width="650px"
    AllowSorting="True" ShowFooter="True" EnableAJAX="True" 
    AllowFilteringByColumn="True" CellSpacing="0">
    <ClientSettings EnableRowHoverStyle="True">
        <Selecting AllowRowSelect="True" />
        <ClientEvents OnRowClick="Dummy"></ClientEvents>
        <Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true" ScrollHeight="500px" />
    </ClientSettings>
    <PagerStyle Mode="NumericPages" Position="TopAndBottom" />
    <MasterTableView DataSourceID="SqlDataSource1" AutoGenerateColumns="False" AllowAutomaticDeletes="true"
        DataKeyNames="CourseIDX" CommandItemDisplay="TopAndBottom" ClientDataKeyNames="CourseIDX"
        TableLayout="Fixed" AllowCustomSorting="True" AllowFilteringByColumn="true">
        <Columns>
            <telerik:GridBoundColumn DataField="CourseIDX" UniqueName="CourseIDX" HeaderText="CourseIDX"
                Display="False" ItemStyle-Width="50px">
                <ItemStyle Width="50px"></ItemStyle>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CourseID" UniqueName="CourseID" HeaderText="CourseID"
                Display="false" ItemStyle-Width="50px">
                <ItemStyle Width="50px"></ItemStyle>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name" Display="True"
             AllowFiltering="True" 
             AllowSorting="True">
                <ItemStyle Width="300px" HorizontalAlign="Left" />
                <HeaderStyle Width="300px" />
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="Preview" UniqueName="Preview" AllowFiltering="false" >
                <ItemTemplate>
                    <asp:HyperLink ID="Preview" runat="server" ImageUrl="~/images/fileimages/preview.gif"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="50px" HorizontalAlign="Center" />
                          <HeaderStyle Width="50px" HorizontalAlign="Center" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Course " UniqueName="EditCourse" AllowFiltering="false" >
                <ItemTemplate>
                    <asp:HyperLink ID="EditCourse" runat="server" ImageUrl="~/radcontrols/outlook/grid/edit.gif"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="50px" HorizontalAlign="Center" />
                <HeaderStyle Width="50px" HorizontalAlign="Center" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Edit Tree" UniqueName="EditTree" Display="false" AllowFiltering="false" >
                <ItemTemplate>
                    <asp:HyperLink ID="EditTree" runat="server" ImageUrl="~/images/fileimages/FileTreeView.gif"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="50px" HorizontalAlign="Center" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Lectures" UniqueName="EditSheet" AllowFiltering="false" >
                <ItemTemplate>
                    <asp:HyperLink ID="EditSheet" runat="server" ImageUrl="~/images/fileimages/Edit.gif"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="50px" HorizontalAlign="Center" />
                          <HeaderStyle Width="50px" HorizontalAlign="Center" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Points" UniqueName="Points"  AllowFiltering="false" >
                <ItemTemplate>
                    <asp:HyperLink ID="Points" runat="server" ImageUrl="~/images/fileimages/tasks.gif"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="50px" HorizontalAlign="Center" />
                          <HeaderStyle Width="50px" HorizontalAlign="Center" />
            </telerik:GridTemplateColumn>
            <telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Student Status" ImageUrl="~/radcontrols/vista/grid/windows/update.gif"
                CommandName="SStatus" UniqueName="SStatus" Display="false" ShowFilterIcon="false" >
                <ItemStyle Width="50px" HorizontalAlign="Center" />
                          <HeaderStyle Width="50px" HorizontalAlign="Center" />
            </telerik:GridButtonColumn>
            <telerik:GridButtonColumn UniqueName="column" HeaderText="Delete" ConfirmText="Confirm Delete of Course!!!"
                Text="Delete" CommandName="Delete" ButtonType="ImageButton" ConfirmDialogType="RadWindow">
                <ItemStyle Width="40px" HorizontalAlign="Center" />
                          <HeaderStyle Width="40px" HorizontalAlign="Center" />
            </telerik:GridButtonColumn>
        </Columns>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
        <RowIndicatorColumn Visible="False">
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <ExpandCollapseColumn Resizable="False" Visible="False">
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
        <EditFormSettings>
            <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
            </EditColumn>
            <PopUpSettings ScrollBars="None"></PopUpSettings>
        </EditFormSettings>
        <CommandItemTemplate>
            &nbsp; &nbsp;
            <telerik:RadButton ID="btnAdd" runat="server" OnClientClicked="ShowAdd" Text="Create New Course"
                ToolTip="Create New Course " Font-Size="XX-Small" Skin="Telerik">
                <Icon PrimaryIconUrl="~/images/fileimages/AddRecord.gif" PrimaryIconLeft="5px" />
            </telerik:RadButton>
            &nbsp;
            <telerik:RadButton ID="btnDuplicate" runat="server" OnClientClicked="ShowDuplicate"
                Text="Duplicate Course" ToolTip="Duplicate Course " Font-Size="XX-Small" Skin="Telerik">
                <Icon PrimaryIconUrl="~/images/fileimages/File-copy-16.png" PrimaryIconLeft="5px" />
            </telerik:RadButton>
            &nbsp;
            <telerik:RadButton ID="btnTextBooks" runat="server" OnClientClicked="ShowPDF" Text="Textbook Lists"
                ToolTip="Textbook Lists " Font-Size="XX-Small" Skin="Telerik">
                <Icon PrimaryIconUrl="~/images/fileimages/pdf.png" PrimaryIconLeft="5px" />
            </telerik:RadButton>
        </CommandItemTemplate>
    </MasterTableView>
    <ExportSettings>
        <Pdf PageBottomMargin="" PageFooterMargin="" PageHeaderMargin="" PageHeight="11in"
            PageLeftMargin="" PageRightMargin="" PageTopMargin="" PageWidth="8.5in" />
        <Excel Format="Html"></Excel>
        <Csv RowDelimiter="NewLine" ColumnDelimiter="Comma"></Csv>
    </ExportSettings>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</telerik:RadGrid>

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Jun 2012, 04:46 AM
Hi David,

Are you getting any Javascript error in IE? I got the filtering working in your code by attaching all the Client side events correctly.

Thanks,
Shinu.
0
david
Top achievements
Rank 1
answered on 15 Jun 2012, 12:55 PM
Hi Shinu

no JS errors, my client side events work nicely.
The grid populates nicely but the filter has no effect.

Here is the datasource:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:edwaydbConnectionString %>"     
SelectCommand="Instructor_List_Courses_Detail" SelectCommandType="StoredProcedure"     
DeleteCommand="Delete from Courses WHERE CourseIDX=@CourseIDX">     
<SelectParameters>         
<
asp:SessionParameter Name="InstructorID" SessionField="EdwayInstructorID" Type="Int32" />         
<asp:controlparameter ControlID="ddlYEsNo" DefaultValue="Y" Name="Active"                 
PropertyName
="SelectedValue" />    
 </SelectParameters>     
<DeleteParameters>         
<
asp:Parameter Name="CourseID" Type="String" />     
</
DeleteParameters> </asp:SqlDataSource>
Tags
Grid
Asked by
david
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
david
Top achievements
Rank 1
Share this question
or