INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

From Date To Date Return Total Hours ASP.NET FORM

From Date To Date Return Total Hours ASP.NET FORM

(OP)
Below is my code and it simply renders 2 textboxes and a button. The first textbox value will be "FROM DATE" and the second textbox value will be "TO DATE". The database table has a column for Hours and a Column for Date. When the end user submits their entry, I would like to return the total hours between the two dates provided. I'm having trouble researching this scenario as it appears to be more complex than I imagined it would be, any help would be gratefully appreciated!

Thanks






////////////////////////////////////////CODE///////////////////////////////////////////////////

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>

<script>
$(function () {
$("#datepicker2").datepicker();
});
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<p>From
<asp:TextBox ID="datepicker" runat="server"></asp:TextBox>
</p>
<p>&nbsp;</p>
<p>To <asp:TextBox ID="datepicker2" runat="server"></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" Text="Button" />

</div>
</form>
</body>
</html>

RE: From Date To Date Return Total Hours ASP.NET FORM

I have excatly the same situation on a time sheet entry site, what I did is created an SQL function that calculates the differential and give the result on the post back. The SQL is very easy to write using the DATEDIFF() function

RE: From Date To Date Return Total Hours ASP.NET FORM

(OP)
Can you give an example using my layout or any example at all with code behind?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close