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

Apply RadFilter expression to RadGrid without FilterContainerID

8 Answers 244 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Lorenzo
Top achievements
Rank 1
Lorenzo asked on 14 Aug 2010, 02:49 PM
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

8 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 19 Aug 2010, 08:20 AM
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
0
Lorenzo
Top achievements
Rank 1
answered on 20 Aug 2010, 01:45 PM
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



0
Mira
Telerik team
answered on 20 Aug 2010, 03:54 PM
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
0
Lorenzo
Top achievements
Rank 1
answered on 20 Aug 2010, 08:03 PM
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


0
Mira
Telerik team
answered on 23 Aug 2010, 02:59 PM
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
0
K
Top achievements
Rank 1
answered on 16 Mar 2011, 05:46 PM
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.
0
Mira
Telerik team
answered on 17 Mar 2011, 03:22 PM
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
0
Lorenzo
Top achievements
Rank 1
answered on 17 Mar 2011, 03:31 PM
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
Tags
Filter
Asked by
Lorenzo
Top achievements
Rank 1
Answers by
Mira
Telerik team
Lorenzo
Top achievements
Rank 1
K
Top achievements
Rank 1
Share this question
or