EntityDataSource不记得" Where"回调财产

时间:2015-02-14 13:50:44

标签: c# asp.net entity-framework webforms

我有一个启用了ViewState的EntityDataSource。如果用户按下Filter按钮,则我设置EntityDataSource的“Where”属性,然后添加WhereParameter。

当我进行回调时,“Where”属性为null,但仍然记住WhereParameter。我希望EntityDataSource也能记住“Where”属性。我怎样才能做到这一点?

这是我的代码:

<asp:EntityDataSource ID="dsOutgoingShipment" EntitySetName="OutgoingShipment" runat="server" 
    ContextTypeName="DAL.IngramEKAER_Entities" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
</asp:EntityDataSource>

    protected void btnSearch_Click(object sender, EventArgs e)
    {
        dsOutgoingShipment.WhereParameters.Add("Line", System.Data.DbType.String, tbLine.Text);
        dsOutgoingShipment.Where = "it.line=@Line";
    }

0 个答案:

没有答案