I am new to ASP.NET and could use some help writing a where clause for my EntityDataSource.

I have the following EDS:

```
<asp:EntityDataSource ID="RidesEDS" runat="server" 
    ContextTypeName="RamRideOps.RamRideOpsEntities" EnableFlattening="False" 
    EntitySetName="Rides" EnableDelete="True" EnableUpdate="True">
</asp:EntityDataSource>

```

There is a database of 'Rides' and a database of 'AdminOptions' which contains two dates: validDate1 and validDate2... I need the EDS to only show rides that have 'CallTime's between the two valid dates. To facilitate this, on page\_load I am populating two hidden fields with the valid dates (hf\_validDate1 and hf\_validDate2). Can anyone show me what I need to add to the EntityDataSource code to accomplish this by comparing CallTimes to the values of the hf's with a WHERE clause?

EDIT:

Here is what I have so far, not quite working though..

```
<asp:EntityDataSource ID="RidesEDS" runat="server" 
        ContextTypeName="RamRideOps.RamRideOpsEntities" EnableFlattening="False" 
        EntitySetName="Rides" EnableDelete="True" EnableUpdate="True" Where="it.TimeOfCall > @validDate1Param AND it.TimeOfCall < @validDate2Param">

        <WhereParameters>
        <asp:ControlParameter ControlID="hf_validDate1" DbType="DateTime" 
          DefaultValue="1/01/2012 12:00:00 PM" Name="validDate1Param" PropertyName="Value" />
          <asp:ControlParameter ControlID="hf_validDate2" DbType="DateTime" 
          DefaultValue="1/01/2112 12:00:00 PM" Name="validDate2Param" PropertyName="Value" />
        </WhereParameters>
    </asp:EntityDataSource>

<asp:HiddenField ID="hf_validDate1" runat="server" />
<asp:HiddenField ID="hf_validDate2" runat="server" />

```

Code-Behind:

```
protected void Page_Load(object sender, EventArgs e)
        {
            using(RamRideOpsEntities myEntities = new RamRideOpsEntities())
            {
                var validDates = (from a in myEntities.AdminOptions
                                  select new { a.ValidDate1, a.ValidDate2 }).FirstOrDefault();

                if(validDates != null)
                {
                    hf_validDate1.Value = validDates.ValidDate1.ToString();
                    hf_validDate1.Value = validDates.ValidDate2.ToString();
                }
            }            
        }

```