• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Contact Form creation help?

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

  • 3
  • 2
1 Solution
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 ...
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 ...
ianinspainAuthor Commented:
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?

>>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?
ianinspainAuthor Commented:
Thanks for your help. I did go down the panel route but saved your ideas for future projects.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now