PDA

View Full Version : Jason's Date Input Calendar field value email



ssmith
08-23-2011, 02:19 PM
1) Script Title: Jason's Date Input Calendar

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm

3) Describe problem:

I am using .net C# and i have a form with a data filed that uses Jason's Date Input Calendar. I then have a mail script with sends an email out with the form field values. However, i cannot get the data field passed through to the mail script. ive tried calling the hidden field but it doesnt work.

Here is the form;

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="email.aspx.cs" Inherits="emailtest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Complaint</title>
<script type="text/javascript" src="calendarDateInput.js">
</script>
</head>
<body>

<form id="form1" runat="server">
<div>
<asp:Table ID="Table1" runat="server" Width="100%" border="1" cellpadding="2" cellspacing="5" bordercolor="#000066"
HorizontalAlign="Left">


<asp:TableRow><asp:TableCell ColumnSpan="5" BorderWidth="0">Date: <script type="text/javascript">DateInput('orderdate', true, 'DD-MON-YYYY')</script> DateInput('orderdate', true, 'DD-MON-YYYY')</script><script type="text/javascript"> Response.Write(Session["orderdate"])</script>
</asp:TableCell></asp:TableRow>
<asp:TableRow><asp:TableCell ColumnSpan="5" BorderWidth="0"><asp:Button ID="btnSend" runat="server" Text="Send" onclick="btnSend_Click" />
</asp:TableCell></asp:TableRow>
</asp:Table>


</div>
</form>
</body>
</html>
Here is the mail script;

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;


public partial class emailtest : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{


}
protected void btnSend_Click(object sender, EventArgs e)
{

//Create the mail message
using (MailMessage mail = new MailMessage())
{
try
{


mail.To.Add(new MailAddress("email@email.com"));
mail.From = new MailAddress("email@email.com", "test");
mail.IsBodyHtml = true;
mail.Subject = "test";
mail.Body = "Date: " + orderdate.Text;

SmtpClient smtp = new SmtpClient();
smtp.Host = "";
smtp.Send(mail);
lblMessage.Text = "Successfully sent";
}
catch (Exception ex)
{
lblMessage.Text = "Problem sending email. Reason code: " + ex.Message;
}
}
}
}


Thank you for any help you can give.