Contact Form creation help?

Posted on 2005-05-03
Medium Priority
Last Modified: 2010-04-07
Hi there,

i have just created a contact form on my contact.aspx, it uses code behind. so what i intended to was this

Create 1 panel (asp control) and place tables, textboxes etc into this

Create another panel (asp control) and place 2 confirmation msgs i.e. "Confirmed!", and "OOps a problem, couldn't send mail"

Now i think i am going down the right way? Basically i make panel 1 visibal but on postback i make panel 1 invisible and then make panel 2 visible.

Panel 2 will then either say "Confirmed" or "NOT" .. my question is,.. is this correct and how to do i switch between the 2 different msgs in panel 2?

Should i use a standard Label control(asp control) , i.e. label 1 and label 2... and then make either label1 or label2 invisible depending on the outcome OR use more panels, i think panels carry quite alot of overhead?

Any ideas or advice would be really appreciated

Question by:ianinspain
  • 3
  • 2
LVL 26

Accepted Solution

Rejojohny earned 1500 total points
ID: 13917269
a better option would be to show message to the user in the form of a messagebox and always show the textboxes etc in ur panel one .. so that he can see what he has posted and the reason for the error.. for that u can use the following code

Dim lstrScript as string = "<Script langauge = javascript>" & vbcrlf

if error occured .. some logic u already have
          lstrScript += "alert('OOps a problem, couldn't send mail');"
          lstrScript += "alert('Confirmed');"
end if
lstrScript += "</Script>"

RegisterStartupScript("Message", lstrScript)

no need to use panels and make them visible and invisible ...
LVL 26

Expert Comment

ID: 13917283
just note that all this code will be in ur code-behind .. that is the place where u r processing ur code to send the mail etc .. maybe on a button click event or something like that ...

Author Comment

ID: 13931376
Thanks for your comments, but i really want to do it the way displaying different information on the same page depending on the outcome. i want to try and keep away from using pop boxes etc

Are you aware of the best way to do this using the same page, is using panels good and then controlling what is in the second panel, using another panel or is that too much overhead?

LVL 26

Expert Comment

ID: 13933292
>>way displaying different information on the same page depending
The message is indeed displayed in the same page ...

>> i want to try and keep away from using pop boxes etc,
what would the reason be .. showing error using messagebox is a standard way to do it and the most efficient .. anyway u might have ur reasons .. using panels would not be too much of a overhead, but managing it would be the problem for u (making it visible/invisible) .. what would happen when u have shown the user the error message in the panel .. what will he have to do to try the process again?

Author Comment

ID: 13942750
Thanks for your help. I did go down the panel route but saved your ideas for future projects.



Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question