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 7052211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:21:23+00:00 2026-05-28T03:21:23+00:00

I am using the following date picker in a mobile asp.net mvc razor website

  • 0

I am using the following date picker in a mobile asp.net mvc razor website
http://jquerymobile.com/demos/1.0a4.1/experiments/ui-datepicker/

  1. what i want to do is use server date time instead of client datetime as the default time, where should i place the datetime from my viewbag
  2. when my first date field is filled with a date the second date field must have the date + 7 days

    public ActionResult Index()
    {
           ViewBag.datetime1 = System.DateTime.Now
           ViewBag.datetime2 = System.DateTime.Now.AddDays(7)
    }
    
    <div id="startPicker">
       <input id="PickUpDate"  name="PickUpDate" type="date" value="" class="smaller" required="true"/>           
    </div>
    <div id="endPicker">
       <input id="DropOffDate"  name="DropOffDate" type="date" value="" class="smaller"  required="true"/>           
    </div>
    
    <script type="text/javascript">
    
    
         $(function () {
    
             $(".ui-datepicker").hide();
    
             // startDate datepicker
             var idDivStart = $("#startPicker div").attr("id");
    
             $("#PickUpDate").focus(function () {
                 $("#" + idDivStart + " .ui-datepicker").show();
             });
    
             // endDate datepicker
             var idDivEnd = $("#endPicker div").attr("id");
    
             $("#DropOffDate").focus(function () {
                 $("#" + idDivEnd + " .ui-datepicker").show();
             });
    
             //
             $(".ui-datepicker-calendar a").live("click", function () {
                 $(".ui-datepicker").hide();
             });
    
             //
             $(".inputsText").focus(function () {
                 $(".ui-datepicker").hide();
             });
             //
             $("div").attr("tabindex", -1).focus(function () {
                 $(".ui-datepicker").hide();
             });
         });
    
    </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-05-28T03:21:23+00:00Added an answer on May 28, 2026 at 3:21 am

    In document ready set (if you add ServerDateTime to ViewBag)

    $("#PickUpDate").datepicker( "setDate" , '@ViewBag.ServerDateTime')
    
    $("#PickUpDate").change(function(){
    
    $("#DropOffDate").datepicker( "setDate" ,$("#PickUpDate".getDate() + 7 ) )
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following attached date picker. http://rapidshare.com/files/417385026/jQuery_Date_Picker.zip http://www.2shared.com/file/d2NK63P-/jQuery_Date_Picker.html Problem is if i don't
I'm using the jQuery Date Picker plugin by Kelvin Luck ( http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/ ) and
I'm using the time picker control from the following link: http://fgelinas.com/code/timepicker/timepicker.html It works super
I'm using the time picker control from the following link: http://fgelinas.com/code/timepicker/timepicker.html It works super
i'm using jquery in report section in my asp.net mvc project.But i had problem
i am using jquery ui date picker for take fromDate and toDate Following is
Ok I'm using the jQuery Mobile Framework and adding the Experimental Date Picker but
I have the following date as string 091020. I am using SubSonic as my
I am using the following method to serialize a date as a string private
I've recently been using the following piece of code to limit my 2nd Date

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.