除非指定AutoGenerateWhere == true或Where,否则无法指定WhereParameters

时间:2013-02-22 09:56:15

标签: c# asp.net entity-framework

我尝试更改网站时出现了一个奇怪的错误。我总是得到同样的错误

  除非WhereParameters或指定了Where,否则无法指定

AutoGenerateWhere == true

我已经检查了我的EntityDataSource它应该没问题。名称前面有@的

没有典型的参数错误
 <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=HolidayTrackerEntities" DefaultContainerName="HolidayTrackerEntities"
        EnableFlattening="False" EntitySetName="PublicVacations" Where="it.BusinessUnitId == @BusinessUnitId">
        <WhereParameters>
            <asp:SessionParameter DbType="Int32" SessionField="BusinessUnitId" Name="BusinessUnitId" />
        </WhereParameters>
    </asp:EntityDataSource>

我在Rebuild,Clean ...之后得到了同样的信息......

感谢您的帮助和快速回答

2 个答案:

答案 0 :(得分:2)

我是你应该添加AutoAnerateWhereClause =“true”我希望它有所帮助

答案 1 :(得分:0)

对于Telerik RadGrid,这可能是由AllowFilteringByColumn="true"设置引起的。如果除了默认的Where控制子句之外还需要自定义过滤,您可以在论坛帖子中看到Rosen的演示here

相关问题