RadGrid Filtering EnableLinqExpressions

12 posts, 0 answers
  1. J
    J avatar
    5 posts
    Member since:
    Jul 2011

    Posted 13 Jul 2011 Link to this post

    We upgraded to 4.0 and now none of our filtering works correctly.  I've set EnableLinqExpressions="false" on one page and solved the problems on that page/grid.  Will we have to through our whole app and add & set this tag to every grid or is there a work around????  Additionally, there now seems to be issues with Grid formatting and conflicts with css???  Any clues?  Thank you.
  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 19 Jul 2011 Link to this post

    Hello J,

    The provided information is not enough for us to fully understand your scenario. Could you please provide a little bit more details?
    What version of RadControls for ASP.NET AJAX have you upgraded to? How is the grid filtered? What is the datasource of the grid and how do you bind it?
    Sending us a sample project will be highly appreciated.

    I am looking forward to your reply.

    Greetings,
    Mira
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. J
    J avatar
    5 posts
    Member since:
    Jul 2011

    Posted 20 Jul 2011 Link to this post

    We Upgraded libraries to v2011.1.621.40.   Now none of the filtering is working on any of the pages.  Adding EnableExpressions="false" to Grids on a page corrects the problem.  Do I really have to go add EnableExpressions="false" to every grid throughout the app to correct this problem?  This is a huge inconvenience.

    It's bound to a dataset returned from MS SQL.  See code below

     

     

    <telerik:RadGrid AutoGenerateColumns="False" ID="uxRadGrid" AllowFilteringByColumn="true" OnNeedDataSource="uxRadGrid_NeedDataSource"

     

     

     

    OnItemCommand="uxRadGrid_ItemCommand" OnItemDataBound="uxRadGrid_ItemDataBound" AllowPaging="true" PageSize="50" AllowSorting="True"

     

     

     

    runat="server" EnableEmbeddedSkins="false">

     

     

     

    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"/>

     

     

     

    <GroupingSettings CaseSensitive="false" />

     

     

     

    <clientsettings>

     

     

     

    <Scrolling ScrollHeight="500px" AllowScroll="True" SaveScrollPosition="True" UseStaticHeaders="True" >

     

     

     

    </Scrolling>

     

     

     

    <ClientEvents OnGridCreated="GridCreatedWTHScroll" />

     

     

     

    </clientsettings>

     

     

     

    <MasterTableView OverrideDataSourceControlSorting="true" />

     

     

     

    <MasterTableView TableLayout="Fixed" AllowFilteringByColumn="true" EnableHeaderContextMenu="true">

     

     

     

    <Columns>

     

     

     

    <telerik:GridTemplateColumn Visible="false">

     

     

     

    <ItemTemplate>

     

     

     

    <asp:Label ID="uxId" runat="server" Text='<%#Eval("ProgTargetID")%>' />

     

     

     

    </ItemTemplate>

     

     

     

    </telerik:GridTemplateColumn>

     

     

     

    <telerik:GridBoundColumn HeaderText="#" DataField="RowNum" UniqueName="RowNum" SortExpression="RowNum"

     

     

     

    HeaderStyle-Width="3%" AutoPostBackOnFilter="true" AllowFiltering="false" />

     

     

     

    <telerik:GridTemplateColumn Groupable="false" HeaderText="Program Target Name" UniqueName="ProgTargetName" AutoPostBackOnFilter="true"

     

     

     

    HeaderStyle-Width="30%" SortExpression="ProgTargetName" DataField="ProgTargetName" FilterControlWidth="260px" CurrentFilterFunction="Contains"

     

     

     

    ShowFilterIcon="true" AndCurrentFilterFunction="Contains">

     

     

     

    <ItemTemplate><asp:LinkButton runat="server" ID="lnkName" Text='<%#Eval("ProgTargetName")%>' PostBackUrl="return false" CommandName="EditRecord" /></ItemTemplate>

     

     

     

    </telerik:GridTemplateColumn>

     

     

     

    <telerik:GridBoundColumn HeaderText="Status" DataField="StatusName" UniqueName="StatusName" SortExpression="StatusName"

     

     

     

    HeaderStyle-Width="7%" FilterControlWidth="30px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

     

     

     

    AndCurrentFilterFunction="Contains" />

     

     

     

    <telerik:GridBoundColumn HeaderText="Description" DataField="ProgTargetDesc" UniqueName="ProgTargetDesc" SortExpression="ProgTargetDesc"

     

     

     

    HeaderStyle-Width="31%" FilterControlWidth="275px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

     

     

     

    AndCurrentFilterFunction="Contains" />

     

     

     

    <telerik:GridBoundColumn HeaderText="Modified On" DataField="TranDate" UniqueName="TranDate" SortExpression="TranDateRaw"

     

     

     

    HeaderStyle-Width="14%" FilterControlWidth="100px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

     

     

     

    AndCurrentFilterFunction="Contains" />

     

     

     

    <telerik:GridBoundColumn HeaderText="Modified By" DataField="ByUser" UniqueName="ByUser" SortExpression="ByUser"

     

     

     

    HeaderStyle-Width="14%" FilterControlWidth="80px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

     

     

     

    AndCurrentFilterFunction="Contains" />

     

     

     

     

    <telerik:GridTemplateColumn HeaderText="Action" AllowFiltering="false" Visible="false" HeaderStyle-Width="10%">

     

     

     

    <ItemTemplate>

     

     

     

    <asp:LinkButton ID="lnkEdit" Text="Edit" runat="server" PostBackUrl="return false;" CommandName="EditRecord" />&nbsp;|

     

     

     

    <asp:LinkButton ID="lnkDisable" Text="Disable" runat="server" CommandName="EnableDisable" />

     

     

     

    </ItemTemplate>

     

     

     

    </telerik:GridTemplateColumn>

     

     

     

    </Columns>

     

     

     

    </MasterTableView>

     

     

     

    </telerik:RadGrid>

     

     




     

     

    /// <summary>

     

     

     

    /// Need Datasource event of RadGrid

     

     

     

    /// </summary>

     

     

     

    /// <param name="source"></param>

     

     

     

    /// <param name="e"></param>

     

     

     

    protected void uxRadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

     

    {

     

     

    try

     

    {

    CLEARTrackerCNI.Framework.

     

    ProgramTarget obj = new CLEARTrackerCNI.Framework.ProgramTarget();

     

    obj.PageSize = uxRadGrid.PageSize;

    obj.PageNum = uxRadGrid.CurrentPageIndex;

    obj.SortExpression = uxRadGrid.MasterTableView.SortExpressions.GetSortString();

    obj.FilterExpression = uxRadGrid.MasterTableView.FilterExpression;

     

     

    DataSet ds = obj.GetAll();

     

     

     

    if (Convert.ToInt32(ds.Tables[0].Rows[0][Fields.Cnt]) > 0)

     

    {

    trMessage.Visible =

     

    false;

     

    trGrid.Visible =

     

    true;

     

    uxFilters.Visible =

     

    true;

     

    uxRadGrid.AllowCustomPaging =

     

    true;

     

    uxRadGrid.VirtualItemCount =

     

    Convert.ToInt32(ds.Tables[0].Rows[0][Fields.Cnt]);

     

    uxRadGrid.CurrentPageIndex =

     

    Convert.ToInt32(uxRadGrid.CurrentPageIndex);

     

    uxRadGrid.PageSize =

     

    Convert.ToInt32(uxRadGrid.PageSize);

     

    uxRadGrid.DataSource = ds.Tables[1];

    uxRadGrid.PagerStyle.AlwaysVisible =

     

    true;

     

    }

     

     

    else

     

    {

    uxRadGrid.AllowCustomPaging =

     

    true;

     

     

     

    if (uxRadGrid.MasterTableView.FilterExpression == string.Empty)

     

    {

    trGrid.Visible =

     

    false;

     

    uxFilters.Visible =

     

    false;

     

    trMessage.Visible =

     

    true;

     

    lblMessage.Text =

     

    Messages.Get("NoRecord");

     

    }

     

     

    else

     

    {

    uxFilters.Visible =

     

    true;

     

    uxRadGrid.DataSource =

     

    String.Empty;

     

    trGrid.Visible =

     

    true;

     

    uxRadGrid.PagerStyle.AlwaysVisible =

     

    false;

     

    }

    uxRadGrid.VirtualItemCount = 0;

    }

    }

     

     

    catch (Exception ex) { Common.Log("ProgramTarget:List", "uxRadGrid_NeedDataSource", ex, Page); }

     

    }




     

     

    public override DataSet GetAll()

     

    {

     

     

    Hashtable prms = new Hashtable();

     

     

     

    //if (StatusId > 0) prms[Fields.ProgramTargetStatus] = StatusId;

     

    prms[

     

    Fields.PageNum] = PageNum;

     

    prms[

     

    Fields.PageSize] = PageSize;

     

    prms[

     

    Fields.FilterExp] = FilterExpression;

     

    prms[

     

    Fields.SortExp] = SortExpression;

     

     

     

    DataSet ds = MsSql.ExecuteNoTransQuery(StoredProcedure.GetProgramTarget(prms));

     

     

     

    if (MsSql.IsEmpty(ds)) return null;

     

     

     

    return ds;

     

    }


     

     

     

    /// <summary>

     

     

     

     

     

     

     

    /// p_GET_ProgramTargets

     

     

     

     

     

     

     

    /// </summary>

     

     

     

     

     

     

     

    /// <param name="prms">@FilterExp, @SortExp, @PageNum, @PageSize</param>

     

     

     

     

     

     

     

    /// <returns>String. Formatted sql statement.</returns>

     

     

     

     

     

     

     

    public static String GetProgramTarget(Hashtable prms)

     

    {

     

     

    return MsSql.GetSqlStmt("p_GET_ProgramTargets", prms);

     

    }

  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 21 Jul 2011 Link to this post

    Hello J,

    Setting EnableLinqExpressions to false is required for filtering grid which is bound to a DataTable.
    The default value of this property is true, so you would not have to set it if you use LinqDataSource for example.

    I hope this helps.

    All the best,
    Mira
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  6. J
    J avatar
    5 posts
    Member since:
    Jul 2011

    Posted 21 Jul 2011 Link to this post

    No, this doesn't help at all! This is not a new application.  It was an existing project for which we upgraded the Telerik libraries to the latest version.  This tag was not needed in 3.5.  Why would you make that a requirement in 4.0?????  This is ridiculous and very inconvenient.  If we'd known this we wouldn't have upgraded.  If we are having this issue, I know there are a lot other companies having this issue.
  7. SWAT
    SWAT avatar
    12 posts
    Member since:
    Dec 2008

    Posted 07 Sep 2011 Link to this post

    i agree with J. adding mandatory properties that brakes the on-going applications is a pain.
    The EnableLinqExpressions is hurting the RadGrid in other places as well (such as in Sum Aggregate function for SmallInt SQL datatype field (which is treated as Byte by the grid), and Count Aggregate for template column that is not bound to any field [row number column for instance]).

    Ilan.
  8. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 07 Sep 2011 Link to this post

    Hello,

    When the LINQ expressions of the RadGrid are enabled, the performance is significantly improved because the grid uses dynamic LINQ expressions for all data operations.
    However, this leads to some limitations and that is why the EnableLinqExpressions property is provided.

    Please let us know if any further questions arise.

    Greetings,
    Mira
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  9. Aaron
    Aaron avatar
    3 posts
    Member since:
    Apr 2010

    Posted 29 Feb 2012 Link to this post

    "Setting EnableLinqExpressions to false is required for filtering grid which is bound to a DataTable."

    Where is the documentation on this?

    If it is documented, please consider documenting it here as well - http://www.telerik.com/help/aspnet-ajax/grid-binding-to-datatable-or-dataset.html.
  10. John Chatt
    John Chatt avatar
    24 posts
    Member since:
    Feb 2010

    Posted 01 Mar 2012 Link to this post

    I agree with Aaron this is ridiculous. Document this better, it's not like this is new
  11. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 05 Mar 2012 Link to this post

    Hello,

    It seems a little misunderstanding has occured here - it is fine to bind to a DataTable and not set EnableLinqExpressions="false" as long as you do not perform manual filtering that requires T-SQL syntax. I am attaching a sample page which demonstrates a grid being bound to a DataTable and filtering seamlessly with filter expressions turned on.

    The need for turning off LINQ expressions in scenarios where filtering is done using Transact SQL syntax is noted in each help topic elaborating on filter expressions. The note states:
    With the .NET 3.5 build of RadGrid for ASP.NET AJAX and LINQ filter expressions enabled (EnableLinqExpressions = true), the filter expressions set for the grid either internally by its filtering mechanism or manually in code should conform to the LINQ expression syntax instead of the old T-SQL syntax. Only thus they will be evaluated properly by the control.

    Kind regards,
    Tsvetina
    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.
  12. J
    J avatar
    5 posts
    Member since:
    Jul 2011

    Posted 05 Mar 2012 Link to this post

    I don't think there is a misunderstanding and I am not sure what the point is.  We were using manual filtering as well as the filtering built into the grid interchangeably in our application.  This was working fine with the previous version of the controls.  When we upgraded our controls, suddenly filtering quit working.  We discovered then that this new tag was added and required to  be set on the grid with the new controls for filtering to work correctly, therefore we had to go through the whole application and add this tag to every page/grid that had filtering enabled.  The point is that Telerik added a required tag to the grid control that was not required in previous version therefore inconveniencing your customers.
  13. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 06 Mar 2012 Link to this post

    Hello,

    We understand your frustration and we know that it could be annoying to have to go through many pages and add settings that were not previously needed. However, as the new LINQ-based queries of RadGrid improved performance of RadGrid a lot, it was not in the general customer's interest to leave them turned off by default. We try to offer the customer the best possible performance and behavior from the control with the least amount of customizations, of course, where this is possible.
    Excuse us for any inconvenience caused by this, I hope that we do not lead you to such experience with future versions of the grid.

    Regards,
    Tsvetina
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017