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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:44:32+00:00 2026-05-31T13:44:32+00:00

I’m developing a project in MVC 3 (CRUD)… I want to create a reservation

  • 0

I’m developing a project in MVC 3 (CRUD)… I want to create a reservation for a tennis court…

Page:

enter image description here

So, when I type a “Start time” (“heure de début” in French) I want to increase the “FinishTime” in red (“heure de fin” in French) dynamically… If it’s a simple match increase by 1:00 and if not by 2:00…

I’m beginner in MvC3 so I have no idea how to do that… Of course, I’m not request that you make my work but the right method to do that and if it’s possible an example…

View:

@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
    <legend>Reservation</legend>

    <div class="editor-label">
        @Html.LabelFor(model => model.Date)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Date)
        @Html.ValidationMessageFor(model => model.Date)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.StartTime)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.StartTime)
        @Html.ValidationMessageFor(model => model.StartTime)
    </div>


    <div class="editor-label">
        @Html.LabelFor(model => model.Simple)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Simple)
        @Html.ValidationMessageFor(model => model.Simple)
    </div>


    <div class="editor-label">
        @Html.LabelFor(model => model.FinishTime)
    </div>
    <div class="editor-fieldFinishTime">
        @Html.DisplayFor(model => model.FinishTime)
        @Html.ValidationMessageFor(model => model.FinishTime)
    </div>

    <div class="editor-label">
         @Html.LabelFor(model => model.Customer.Name)
    </div>
    <div class="editor-field">
         @Html.EditorFor(model => model.Customer.Name)
        @Html.ValidationMessageFor(model => model.Customer.Name)
    </div>


    <div class="editor-label">
        @Html.Label("Terrain N°")
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(c=>c.TennisCourtID,ViewBag.TennisCourtID as SelectList)
    </div>

    <p>
        <input type="submit" value="Create" />
    </p>
</fieldset>
}

<div>
@Html.ActionLink("Back to List", "Index")
</div>

I’ve forget to precise that all clubs can have different schedule… For example:

Club 1:
Simple: 1:00
Double: 2:00

Club2:
Simple: 1:30
Double: 2:30

So in my database’s table TennisClub I have an attribute SimpleGameTime and DoubleGameTime… Sorry 🙁

  • 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-31T13:44:33+00:00Added an answer on May 31, 2026 at 1:44 pm

    Bind to the change event of the Input for Start time (check its ID in rendered HTML):

    $("input#TheId").bind("onchange", onStartTimeChanged);
    

    Define a function to parse a time, see this post here on SO.

    In the onStartTimeChanged function get the check box state (update with correct jQuery selector for the control):

    var checked = $('input[type=checkbox]').is(':checked');
    

    Then simply add the parsed date with the proper offset and write that back to the End Time control using toLocaleTimeString().

    Note: I assumed you’ll use JavaScript to perform calculations on client-side. If you prefer to do everything on server-side you have to add an AJAX-enabled method in your controller with the start time and the flag as parameters. In your onStartTimeChanged function you have to call it and asynchronously update the end time when the function return. If there’s a lot of logic (or it’s not trivial) I prefer the server-side solution with AJAX.

    For example (I didn’t check the code so use it cum grano salis) to call a server-side method with POST (you have to pass parameters, as alternative you may use getJson with GET only but you have to work with routing):

    function ComputeEndTime(matchStartTime, isSimpleMatch) {
       var url = '<%= Url.Action("ControllerName", "ComputeEndTime") %>';
       $.post(url, { startTime: matchStartTime, isSimple: isSimpleMatch },
          function(data) {
             return data.endTime;
          }
       );
    }
    

    And your server side function:

    [AcceptPost]
    public ActionResult ComputeEndTime(string startTime, bool isSimple)
    {
       // Perform your calculations then convert to string
       string calculatedEndTime = "";
    
       return Json(new { endTime = calculatedEndTime });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i want to parse a xhtml file and display in UITableView. what is the

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.