Apply RadFilter expression to RadGrid without FilterContainerID

9 posts, 0 answers
  1. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 14 Aug 2010 Link to this post

    Hi all, 
    I'm trying to work out a solution to use RadFilter on a RadGrid without FilterContainerID, but setting the FieldEditors manually.

    My problem is that my RadGrid must show only some of the fields that I want to be able to filter for. i.e. the Grid shows Name and Surname, but the DataSource (which by the way is an ObjectDataSource) provides also JobPosition, HireDate, and so on.
    If I use the FilterContainerID the FieldsEditor are excluded and I can see in the radFilter only the fields "mapped" through a column of the Grid.
    To make a long story short I would like to be able to do something similar to the sample reported in http://www.telerik.com/help/aspnet-ajax/listview-filtering-with-radfilter.html but using the RadGrid control instead of the RadListView.

    Is it somehow possible ?

    Thanks

    Lorenzo

  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 19 Aug 2010 Link to this post

    Hello Lorenzo,

    To implement the desired functionality, I recommend that you filter the data source control directly as shown in this demo.

    I hope this helps.

    Kind regards,
    Mira
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 20 Aug 2010 Link to this post

    Hello Mira,
    I had already seen that DEMO, but I haven't been able to use it....
    I see that in the demo the RadFilter uses the "DataSourceControlID" to filter the DataSource directly and I àguess that the fields used for the filtering are those exposed by the DataSource, but I'm not able to do the same in my project. I'm using an ObjectDataSource which works great on the RadGrid, but if I use it as DatasourceControlID I receive an error of the kind "Reference not set to an instance of an object".
    My preceding failures in using the ObjectDataSource with RadFilter brought me to use it with FilterContainerID with the problems described.
    Am I doing something wrong ?

    Thanks

    Lorenzo



  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 20 Aug 2010 Link to this post

    Hello Lorenzo,

    Do you have null values in the database?
    If yes, please try removing them and let me know whether the issue remains.

    Regards,
    Mira
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 20 Aug 2010 Link to this post

    Hi Mira,
    I'm quite sure that is not the problem. Before giving up with the "DataSourceControlID" approach I had prepared a simple sample that uses a SQLDataSource. The sample is reported below.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="TEST.aspx.vb" Inherits="TEST" %>
     
    <!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>
        <style type="text/css">
        html, body, form, div#Content
        {
            height:100%;
            margin:0px;
            border:0px;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="Content">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            </telerik:RadScriptManager>
             
            <telerik:RadFilter ID="RadFilter1" runat="server" ApplyButtonText="Apply" DataSourceControlID="SDS_Resources">
               
            </telerik:RadFilter>
             
            <telerik:RadGrid ID="RadGrid_Resources" runat="server" AllowPaging="True"
                AllowSorting="True" DataSourceID="SDS_Resources"
                GridLines="None" AutoGenerateColumns="false">
                    <MasterTableView DataSourceID="SDS_Resources">
                     
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
     
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                     
                    <Columns>
                        <telerik:GridBoundColumn DataField="RowNum" HeaderText="Row Num" UniqueName="RowNum"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="RowName" HeaderText="Row Name" UniqueName="RowName"></telerik:GridBoundColumn>
                         
                    </Columns>
                     
                    </MasterTableView>
                     
                <ClientSettings>
                    <Selecting AllowRowSelect="True" />
                </ClientSettings>
                 
            </telerik:RadGrid>
             
            <asp:SqlDataSource ID="SDS_Resources" runat="server"
                ConnectionString="<%$ ConnectionStrings:DBConn %>"
                SelectCommand="SELECT 1 As RowNum, 'Row_1' as RowName UNION SELECT 2, 'Row_2' UNION SELECT 3, 'Row_3' UNION SELECT 4, 'Row_4'">
                </asp:SqlDataSource>
         
        </div>
        </form>
    </body>
    </html>
    In this specific case the DataSource produces no null values.

    The error persists. Attached I put a screenShot of the error produced...I'm sorry it is in italian, but it's meaning should be clear.

    Thanks 

    Lorenzo


  7. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 23 Aug 2010 Link to this post

    Hello Lorenzo,

    Based on the supplied information, it is hard to determine what is causing the error.
    Please open a formal support ticket and send us a small working project, demonstrating your full setup and showing the unwanted behavior.
    We will debug it locally and get back to you.

    Thank you in advance for the cooperation.

    Kind regards,
    Mira
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  8. K
    K avatar
    11 posts
    Member since:
    Jul 2010

    Posted 16 Mar 2011 Link to this post

    Hello,

    Was this problem resolved?  I didn't see it in the Issue tracker.

    I'm having the same issue with an ObjectDataSource.

    Any guidance would be appreciated.
  9. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 17 Mar 2011 Link to this post

    Hello,

    As I have written to Lorenzo, based on the supplied information it is hard to determine what is causing the error.

    Please open a formal support ticket and send us a small working project, demonstrating your full setup and showing the unwanted behavior.
    We will debug it locally and get back to you.

    Regards,
    Mira
    the Telerik team
  10. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 17 Mar 2011 Link to this post

    Hi K,
    I never got out of that and changed my way. I applied the filter to the RadGrid and not to the Datasource and it worked. Not optimal, but for the project I was developing it did fine.

    Lorenzo
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017