I want to write accept messege (not messege box) after user send messege in “contuct us” page.
The messege need to give him acception that the messege was sent to the website manager…
something like:”Your request was received we will contact you as soon as possible”.
But I want the messege will written on the web page in good place, or clear the form
and the messege will apear on the head of the page…
I know that I can redirect to new page and write this messege on it but I looking
for An elegant solution…
the asp.net code is:
@{
var db = Database.Open("MyProjectSite");
var name="";
var email="";
var message="";
var answer="";
Validation.RequireField("name","please insert your name");
Validation.RequireField("email","please insert your email");
Validation.RequireField("message","please insert your message");
Validation.RequireField("answer","please insert your answer");
if(IsPost)
{
name=Request.Form["your_name"];
email=Request.Form["your_email"];
message=Request.Form["your_message"];
var insertMessege="INSERT INTO messegesFromCustomers(name,email,content,isCustomer)"+"VALUES (@0,@1,@2,@3)";
db.Execute(insertMessege,name,email,message,"not customer yet");
db.Close();
}
}
Which code I need to add in my code that the accept messege will appear?
thanks..
I would recommend using two asp:Panel controls. One contains the success message, which is initially hidden; the other the form fields:
When the contact request is successfully saved to the database, set the
Visibleproperty ofpnlSuccessto true andpnlContact.Visibleto false. This will show the same page, but with the message visible and the form hidden.