# Solved: Enquiry Form ASP.NET 3.5 C#



## marques_uk (Jun 22, 2009)

Hello everyone,

I've put together an enquiry form in ASP.NET 3.5 in C#, and it works perfectly fine. I now want to provide the users with feedback saying that their message has been sent and also provide the details they have just entered. Such as Name, Email and Message

At the moment I have simply got 'Message Sent' as feedback. This is done by putting the following code in the codebehind page.

protected void btnSend_Click(object sender, EventArgs e)
{
lblMessage.Visible = true;
}

and this in the main aspx page

<asp:Label ID="lblMessage" runat="server" Text="Message Sent" Visible="false"></asp:Label>

I want to do something similar for the other fields:- 
Name = the filed name is txtName
Email = the field name is txtEmail
Message = the field name is txtMessage

This is how I want it to look on the page after the user has submitted their form.

Message sent on '13/11/09 14:10'

Name: Joe Bloggs
Email: [email protected]
Message: I would like to do this.

Can this be done using the variables? I'm fairly new to ASP.NET so still learning. If anyone who is more advanced could help that would be brilliant.

Thanks in advance
Mark


----------



## MMJ (Oct 15, 2006)

Not sure if I follow, you mean something like:

Response.Write("Text:" + txtName.Text);


----------



## marques_uk (Jun 22, 2009)

Hi MMJ, thanks for your help, yeah its something like that but I need to put that in my label some how, so when my enquiry is sent it gives the user the feedback.

I just tried this, but no luck

<asp:Label ID="lblName" runat="server" Text="Name" + Response.Write(txtName.Text) Visible="false"></asp:Label>

Thanks once again


----------



## MMJ (Oct 15, 2006)

protected void btnSend_Click(object sender, EventArgs e)
{
lblName.Text= "Name:" + txtName.Text;
}

I'm not sure exactly how you want it but that should help.


----------



## marques_uk (Jun 22, 2009)

Thats exactly what I wanted. I thought it was something like that but just couldn't get it right.

Thanks for your help MMJ.


----------

