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

Filtering RadGrid with EntityDataSource

3 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
orim
Top achievements
Rank 1
orim asked on 25 Oct 2012, 08:36 AM
Hi,
i bind my RadGrid to an EntityDataSource.
First i want fill it with a where statement.
In T-SQL like so:  Select Status,Cti,CreatedDate from Table1 where CreatedUser = @LoggedInUser
This works fine. But when i want to filter some columns i get this error
AutoGenerateWhereClause can not be 'true', if Where is defined
My EntityDatasource look like so
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=TestEntities"
    DefaultContainerName="TestEntities" EntitySetName="Table1" OrderBy="it.CreatedDate DESC"
    Select="it.[Status], it.[CreatedDate], it.[CTI]"  AutoGenerateWhereClause="True"
    Where="it.CreatedUser = @LoggedInUser">
    <WhereParameters>
        <asp:Parameter DefaultValue="Test\User1" Name="CreatedUser" DbType="String" />
    </WhereParameters>
</asp:EntityDataSource>
How can i achive this. Fill Grid with where statement and also filtering should work
Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 29 Oct 2012, 03:47 PM
Hi,

This is a limitation of the EntityDataSource, when you are using Where parameters you could not use AutoGeneratedWhereClause. If you want to use the built-in filtering support of RadGrid you do not need to enable the AutoGenerateWhereClause as shown in this online demo application.

Please elaborate a bit more on your requirements.

Regards,
Andrey
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.
0
virender
Top achievements
Rank 1
answered on 25 Dec 2012, 04:21 PM
Hi,

Orim, You got your solutions ?
0
Yunuen Sanchez
Top achievements
Rank 1
answered on 26 Sep 2013, 06:57 AM
Remove the Where clause from your EntityDatasource and move it to a QueryExtender.

Filtering by column should work this way.
Tags
Grid
Asked by
orim
Top achievements
Rank 1
Answers by
Andrey
Telerik team
virender
Top achievements
Rank 1
Yunuen Sanchez
Top achievements
Rank 1
Share this question
or