Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8280641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:45:05+00:00 2026-06-08T09:45:05+00:00

I am trying to take a start date and and end date from a

  • 0

I am trying to take a start date and and end date from a datapicker, then use the start date and enddate to create a list of column dates, when I hardcode the dates in this works fine, however when I try and get the dates from the date pickers they both return null, here is some code
(I am also using MVC3 and Razor, but I think this is a JS thing I am doing wrong.).

using (Html.BeginForm("Index", "Home", FormMethod.Post))
{

<p>
    Start Date:
    <input id='datepicker' name='datepicker' style="width: 85px">
    End Date:
    <input id='datepickerend' name='datepickerend' style="width: 85px">
    @Html.ListBox("teamID", (SelectList)ViewBag.Teams, "--Select a Team--")
    @Html.DropDownList("dealID", (SelectList)ViewBag.Deals, "--Select a Deal--")
    <input type="submit" value="Filter" id="btnFilter" />
</p>}



<script type="text/javascript">

function FormatUkDate(dateStr) {
    dateStr = dateStr.split("/");
    return new Date(dateStr[2], dateStr[1] - 1, dateStr[0]);
}
</script>
<script type="text/javascript">
Date.prototype.addDays = function (days) {
    var dat = new Date(this.valueOf())
    dat.setDate(dat.getDate() + days);
    return dat;
}

function getDates() {
    //        var StartDate = new Date(FormatUkDate($('#datepicker').value));
    //        var EndDate = new Date(FormatUkDate($('#datepickerend').value));
    var StartDate = $('#datepicker').val();
    var EndDate = $('#datepickerend').val();

    var dateArray = new Array();
    while (StartDate <= EndDate) {
        dateArray.push(StartDate)
        StartDate = StartDate.addDays(1);
    }
    return dateArray;
}

</script>


<script>
var daterange = getDates();
var grid;
var colsArray = new Array();
var columns = [
 {
     id: "Name", name: "Name", field: "Name"
 }
  ];
for (i = 0; i < daterange.length; i++) {
    var a = daterange[i].toString()
    a = a.substring(0, 10);
    columns.push({ id: a.valueOf(), name: a.valueOf(), field: a.valueOf() });
}
var options = {
    enableCellNavigation: true,
    enableColumnReorder: true
};

$(function () {
    var myData = [];

    $.getJSON('/Home/getm', function (data) {
        myData = data;
        grid = new Slick.Grid("#myGrid", myData, columns, options);
    });
});
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:45:07+00:00Added an answer on June 8, 2026 at 9:45 am

    The problem was fixed by altering the button to

    with slickme building the grid, and more importantly calling some Ajax which passed the date picker values across fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm at a lose with this one. Trying to take edittext from a list
I'm trying to take a long list of objects (in this case, applications from
net I am trying to take a value from a previous form typically in
I have two sets of drop downs for start date and end date. Each
I'm trying to take an ADO Recordset and then loop through it to parse
I'm trying to take a NSString date in the format 2/22/11 and convert it
I'm trying to take Jenkins from a CI machine, and I would like to
I'm trying to use java.util.Scanner to take Wikipedia contents and use it for word
I am trying to use an Array instead of a list in my query.
I am trying to initialize the CMMotionManager so start updates and create a reference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.