View Single Post
  #1 (permalink)  
Old March 3rd, 2009, 08:24 AM
Will Will is offline
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default referencing controls in code behind

I have a contact form contained within a div. I would like to hide the contact form when it is submitted and display a success type message such as what you have done in your book.

However it wont let me reference the div in the code behind file.

I was originially trying to do something like this in the btnSubmit click event handler.

Code:
lblSuccess.Visible = True
contact1.Visible = False
However this throws an exception because contact1 is a div(I can only assume).

So as far as I can tell I have 2 options. The first longer option is to declare the visibility of each label and control to false when the button is clicked.

The second is to do a Response.redirect to a page just the same but which has the message in it.

Neither of these are ideal the first option is quite long and I don't really want to redirect people either.

So is there a better way that I am missing?
Reply With Quote