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

Filter/sort not working

3 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 21 Feb 2012, 06:54 PM
Hello,

I have already use RadGrid in the past and I don't remember that I had such complications, but right in my application, I have checked 'Enable Sorting', 'Enable Filtering', 'Enable Sorting'

and non of these functionnalities appears.

alse, I wanted to remove the "<CommandItemSettings ExportToPdfText="Export to PDF"/>" line as it doesn't make any sense here, but the line has reappeared I don't know why.

My Grid's code:

<telerik:RadGrid ID="OrderDetail_RadGrid" runat="server" AllowFilteringByColumn="True" AllowSorting="True" CellSpacing="0"
GridLines="None" AutoGenerateColumns="False" DataSourceID="TemporaryOnlineOrdersLines_SqlDataSource">
    <ClientSettings AllowColumnsReorder="True">
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
    <MasterTableView AllowFilteringByColumn="False" AllowSorting="False" DataSourceID="TemporaryOnlineOrdersLines_SqlDataSource">
    <CommandItemSettings ExportToPdfText="Export to PDF"/>
    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
        <HeaderStyle Width="20px"/>
    </RowIndicatorColumn>
    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
        <HeaderStyle Width="20px"/>
    </ExpandCollapseColumn>
    <Columns>
        <telerik:GridBoundColumn DataField="p_Name" FilterControlAltText="Product"
            UniqueName="Product" HeaderText="Product"/>
        <%--<telerik:GridBoundColumn DataField="p_Description" FilterControlAltText="Description" UniqueName="p_Description" HeaderText="Description"/>--%>
        <telerik:GridNumericColumn DataField="tool_Quantity" DecimalDigits="2" FilterControlAltText="Quanity" HeaderText="Qantity"/>
        <telerik:GridBoundColumn DataField="unit_Name"  FilterControlAltText="Unit" UniqueName="unit_Name"  HeaderText="Unit"/>
        <telerik:GridButtonColumn FilterControlAltText="Filter column column" UniqueName="Remove"/>
    </Columns>
 
    <EditFormSettings>
        <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
    </EditFormSettings>
</MasterTableView>
 
<FilterMenu EnableImageSprites="false"></FilterMenu>
</telerik:RadGrid>

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 21 Feb 2012, 11:00 PM
Hello,

Can you please elaborate how you bind the grid control with data? If you would like to take advantage of these grid features, you will need to use advanced binding using NeedDataSource event handling or a data source control (as shown in the example linked above).

Greetings,
Pavlina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Thomas
Top achievements
Rank 1
answered on 21 Feb 2012, 11:06 PM
Here is the datasoute I'm using for this grid:

<asp:SqlDataSource ID="TemporaryOnlineOrdersLines_SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MktgSIonlineConnectionString %>"
     
    SelectCommand="SELECT tool_Id, tool_p_Id, tool_unit_Id, tool_Quantity FROM TemporaryOnlineOrderLine WHERE (tool_too_Id = @too_Id)">
    <SelectParameters>
        <asp:SessionParameter DefaultValue="-1" Name="too_Id" SessionField="TemporaryOnlineOrderId" />
    </SelectParameters>
</asp:SqlDataSource>
0
Pavlina
Telerik team
answered on 24 Feb 2012, 03:28 PM
Hi Thomas,

Filtering and sorting are not working in your case, because you have set AllowSorting and AllowFiltering properties of MasterTableView to false. Please set them to true and everthing should be ok.
<telerik:RadGrid ID="OrderDetail_RadGrid" runat="server" AllowFilteringByColumn="True" AllowSorting="True" CellSpacing="0"
GridLines="None" AutoGenerateColumns="False" DataSourceID="TemporaryOnlineOrdersLines_SqlDataSource">
    <ClientSettings AllowColumnsReorder="True">
         <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
    <MasterTableView AllowFilteringByColumn="True" AllowSorting="True" DataSourceID="TemporaryOnlineOrdersLines_SqlDataSource">

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or