locked
EntityDataSource Problem with Where Clause and DynamicControlParameter RRS feed

  • Question

  • User-1312304163 posted

    Hi:

    I find a problem when I specify a Where Clasue and the DynamicControlParameter exist at same time:

    The code example like:

    <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true"

    Where="It.StartTimeStamp &lt;= CurrentDateTime() AND It.EndTimeStamp &gt; CurrentDateTime()" >

    <WhereParameters>

    <asp:DynamicControlParameter ControlID="FilterRepeater" />

    </WhereParameters>

    </asp:EntityDataSource>

     It just filter the current entries with time sensitive.

    When I load it at first time, the gridview display currectly, but when I click Edit or delete button, it throw a exception.

    I am using the typical template generated ListDetails.aspx

    Just wondering, when dynamic data using the DynamicControlParameter, how will they modified the where clause, it suppose to append not rewrite, is it correct?

    Friday, September 12, 2008 2:05 AM

All replies

  • User-1005219520 posted

    Can you post the exception?

    Friday, September 12, 2008 3:25 AM
  • User-1312304163 posted

    Server Error in '/' Application.

    A type must be specified for each Parameter specified for the EntityDataSource.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: A type must be specified for each Parameter specified for the EntityDataSource.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidOperationException: A type must be specified for each Parameter specified for the EntityDataSource.]
       System.Web.UI.WebControls.EntityDataSource.CreateObjectParametersFromParameterCollection(ParameterCollection paramColl) +876
       System.Web.UI.WebControls.EntityDataSourceView.GenerateWhereClause(String& whereClause, ObjectParameter[]& whereParameters) +168
       System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +484
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
       System.Web.UI.WebControls.GridView.DataBind() +4
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
       System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
       System.Web.UI.WebControls.GridView.OnPreRender(EventArgs e) +17
       System.Web.UI.Control.PreRenderRecursiveInternal() +80
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
    

    Sunday, September 14, 2008 7:23 PM
  • User1641955678 posted

    Not sure what's going on.  What filters would normally be created by the FilterRepeater on this page?  i.e. what columns are they filtering?

    David

    Monday, September 15, 2008 2:47 PM
  • User-1312304163 posted

     

    Hi David:

    It's just a foreign key filter automatically generate by Dynamicdata.

    When I use the page dynamicdata generated, it works fine, the foreign key can filter the entries.

    <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true" >

    <WhereParameters>

    <asp:DynamicControlParameter ControlID="FilterRepeater" />

    </WhereParameters>

    </asp:EntityDataSource> --- Works Fine!!!!!!!!!

     

    <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true"

    Where="It.StartTimeStamp &lt;= CurrentDateTime() AND It.EndTimeStamp &gt; CurrentDateTime()" >

    <WhereParameters>

    <asp:DynamicControlParameter ControlID="FilterRepeater" />

    </WhereParameters>

    </asp:EntityDataSource>----- Exception !!!!!!!!!!!!!!!!!!!!!!!!

     

    <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true"

    Where="It.StartTimeStamp &lt;= CurrentDateTime() AND It.EndTimeStamp &gt; CurrentDateTime()" >

    <WhereParameters>

    </WhereParameters>

    </asp:EntityDataSource>---- Works fine again !!!!!!!!!!!!!!!!!!

    Monday, September 15, 2008 8:36 PM
  • User1641955678 posted

    Thanks, we'll investigate and follow up in a couple days.

    David

    Tuesday, September 16, 2008 11:00 AM
  • User1641955678 posted

    Interestingly, we're not able to repro the error that you are seeing, but we do get a different error, which appears to be caused by an issue in EntityDataSource.  We're following up with the Entity Framework team, which owns that data source control.

    thanks,
    David

    Thursday, September 18, 2008 3:18 PM