radgrid filter with datasource

3 posts, 0 answers
  1. Luigi Bardetti
    Luigi Bardetti avatar
    12 posts
    Member since:
    Oct 2007

    Posted 07 Jul 2015 Link to this post


    i am using your telerik datagrid, every thing works fine but i need to pass the filter values to the sql datasource (or a simple objectdatasource).

    Can you help me?


    <asp:SqlDataSource ID="SqlDataSource1"
                        ProviderName="System.Data.OracleClient" SelectCommand="select * from MAINITEMS" runat="server">
    <telerik:RadGrid runat="server" ID="RadGrid1" Width="99%" Height="600px"
                        AllowFilteringByColumn="True" AllowSorting="True"
                        ShowFooter="False" ShowHeader="True"
                        AllowPaging="True" PageSize="30"
                        ShowGroupPanel="True" >
                            <GroupingSettings CaseSensitive="false" ShowUnGroupButton="true"></GroupingSettings>
                            <%--configurazione per spostare le colonne--%>
                            <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" AllowKeyboardNavigation="true" AllowDragToGroup="True">
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true"></Scrolling>
                            <MasterTableView CommandItemDisplay="None" DataKeyNames="ID" AllowFilteringByColumn="True" >

  2. Luigi Bardetti
    Luigi Bardetti avatar
    12 posts
    Member since:
    Oct 2007

    Posted 07 Jul 2015 in reply to Luigi Bardetti Link to this post

    is it possibile to pass impagination and sort parameters to sqldatasource?
  3. Eyup
    Eyup avatar
    3892 posts

    Posted 10 Jul 2015 Link to this post

    Hello Luigi,

    RadGrid provides advanced databinding methods, which automatically handle the complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations:
    Declarative DataSource
    Programmatic Data Binding

    If you want to define initial Sorting expression, you can use the following approach:
        <telerik:GridSortExpression FieldName="Freight" SortOrder="Descending" />

    In case you want to apply initial filter, you can use the FireCommandEvent method:

    For example:
    Copy Code
    Copy Code
    Copy Code
    Copy Code
    protected void RadGrid1_PreRender(object sender, EventArgs e)
        if (!IsPostBack)
            GridFilteringItem filterItem = RadGrid1.MasterTableView.GetItems(
                 GridItemType.FilteringItem)[0] as GridFilteringItem;
            GridColumn col = RadGrid1.MasterTableView.GetColumn("ShipName");
            col.CurrentFilterValue = "Success";
            filterItem.FireCommandEvent("Filter", new Pair("StartsWith", "ShipName"));

    Hope this helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top