How to filter table row in asp.net mvc
<p>The table currently show all the database data for all days. For example, 08/06/2016, 08/07/2016, 08/08/2016, 08/09/2016. How can I change so it only can show certain days? Like users enter pick two dates in jQuery UI datapicker, then the table only show that two days' data?</p>

<p>I use Ajax. I pass text box date's data to action method to filter the dates, but has error:</p>

<blockquote>
  <p>The parameters dictionary contains a null entry for parameter 'activityStartTime2' of non-nullable type 'System.DateTime' for method 'System.Web.Mvc.ActionResult ShowDateTable(System.DateTime, System.DateTime)' in 'ContosoSite.Controllers.ActivitiesController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
  Parameter name: parameters</p>
</blockquote>

<pre><code>&lt;div&gt;
    Start Date: &lt;input type="datetime" name="startdate" id="start_datepicker2" /&gt;
    End Date: &lt;input type="text" name="enddate" id="end_datepicker2" /&gt;
&lt;/div&gt;

&lt;div&gt;
    &lt;button id="submit_date2" class="btn btn-warning btn-lg"&gt;Submit Date&lt;/button&gt;
&lt;/div&gt;

&lt;div id="display_table2" hidden="true" &gt;
    &lt;p&gt;
        @Html.ActionLink("Create New", "Create")
    &lt;/p&gt;
    &lt;table class="table"&gt;
        &lt;tr&gt;
            &lt;th&gt;&lt;/th&gt;
            &lt;th&gt;@Html.DisplayNameFor(model =&gt; model.ActivityName)&lt;/th&gt;
            &lt;th&gt;@Html.DisplayNameFor(model =&gt; model.Latitude)&lt;/th&gt;
            ....
        &lt;/tr&gt;
        @foreach (var item in Model)
        {
            &lt;tr&gt;
                &lt;td&gt;
                    &lt;a class="btn btn-info btn-lg" onclick="location.href='@Url.Action("Map", "Activities")'"&gt;
                        &lt;span class="glyphicon glyphicon-map-marker"&gt;&lt;/span&gt; Map
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.ActivityName)&lt;/td&gt;
                &lt;td data-toggle="modal" data-target="#myModal"&gt;@Html.DisplayFor(modelItem =&gt; item.Latitude)&lt;/td&gt;
                ....
            &lt;/tr&gt;
        }
    &lt;/table&gt;
&lt;/div&gt;
</code></pre>

<p>Script</p>

<pre><code>&lt;script&gt;
    $("#submit_date2").click(function(){
        $.ajax({
            url: "/Activities/ShowDateTable",
            data : { activityStartTime2: $("#start_datepicker2").val(),
                activityEndTime2: $("#end_datepicker2").val()

            },
            success: function (response) {
                $("#display_table2").show();
            }
        });

        //$("#show_count_number").show();

        //$("#display-start-date").text($("#start_datepicker").val());
        //$("#display-end-date").text($("#end_datepicker").val());
    })
&lt;/script&gt;
</code></pre>

<p>Controller</p>

<pre><code>public ActionResult ShowDateTable(DateTime activityStartTime2, DateTime activityEndTime2)
{
    try
    {
        using (var dbShowDate = new ContosoUniversityDataEntities())
        {

            return View(dbShowDate.Activities.Where(a =&gt; a.ActivityTime &gt;= activityStartTime2 &amp; a.ActivityTime &lt;= activityEndTime2).ToList());
        }
    }
    catch (Exception ex)
    {
        return Content("this not correct");
    }
</code></pre>