lose values upon submit
I am developing a web page that I can receive resume through.
when a user is done with inputting the value, the preview page reads value from the database, and upon the submit, it should email me all the values.
However, when I get it, all I see is blank values.
If I insert a text box at the end, and type a value to it, I receive the value on my email.
it seems the page is not sending me the values that are stored on the server side. It onlu sends me the values on my browser side.
please help.
because of this problem, I could not update the user information either. because user could read the information from the database, but when update, it was saving the old value back.
thank you
<code>
public void Page_Load(object sender, System.EventArgs e)
{
if (IsLoggedIn())
{
// string email=Request.Cookies["email"].Value;
lblEmail.Text=Request.Cookies["email"].Value;
NurseDetails myNurseDetails = new NurseDetails();
Nurse obj = new Nurse();
myNurseDetails = obj.GetNurseDetails(Request.Cookies["email"].Value);
lblGivenName.Text = myNurseDetails.givenname;
lblFamilyName.Text =myNurseDetails.familyname;
obj = null;
}
else
{
Response.Redirect("login.Aspx");
}
}
public static bool IsLoggedIn()
{
HttpContext ctx = HttpContext.Current;
if (ctx.Request.Cookies["email"] == null ||
ctx.Request.Cookies["email"].Value == "")
return false;
else
return true;
}
public class NurseDetails
{
public string emailAddress;
public string givenname;
public string familyname;
}
public class Nurse
{
public Nurse()
{
}
public NurseDetails GetNurseDetails(string strEmail)
{
// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("sp_resume_preview", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter prmemail = new SqlParameter("@emailAddress", SqlDbType.VarChar, 255);
prmemail.Value = strEmail;
myCommand.Parameters.Add(prmemail);
SqlParameter prmgivenname = new SqlParameter("@givenname", SqlDbType.VarChar, 255);
prmgivenname.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(prmgivenname);
SqlParameter prmfamilyname = new SqlParameter("@familyname", SqlDbType.VarChar, 255);
prmfamilyname.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(prmfamilyname);
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
NurseDetails myNurseDetails = new NurseDetails();
myNurseDetails.emailAddress =prmemail.Value.ToString();
myNurseDetails.givenname =prmgivenname.Value.ToString();
myNurseDetails.familyname =prmfamilyname.Value.ToString();
return myNurseDetails;
}
}
void Button1_Click(object sender, EventArgs e) {
// Build a MailMessage
System.Web.Mail.MailMessage mailMessage = new System.Web.Mail.MailMessage();
mailMessage.From =lblEmail.Text;
mailMessage.To = "";
//mailMessage.Cc = "";
mailMessage.Subject = "Online Job Application";
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text;
// TODO: Set the mailMessage.Body property
mailMessage.BodyFormat = MailFormat.Html;
string test="<p>First Name: "+ Request.Form["lblGivenName"]+" Last Name : "+Request.Form["lblFamilyName"];
//////////////////////////
//////////////////////////
mailMessage.Body =test;
//////////////////////////
//mailMessage.Body =txtMessage;
//Response.Write("aftertext");
System.Web.Mail.SmtpMail.SmtpServer = "";
//Response.Write("aftersmtp");
System.Web.Mail.SmtpMail.Send(mailMessage);
//Response.Write("aftersend");
Response.Redirect("resume_confirm.aspx");
}
</code>
|