View Single Post
  #10 (permalink)  
Old February 5th, 2014, 12:07 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Your custom code also fires after the postback in which case the controls like UserNameRequired are no longer present.

I see a few solutions:

1. Redirect the user to a "thank you for registering" page that doesn't have this code.
2. Wrap the code in a panel and set the Visible property to False when the user has been created so this code won't be sent to the browser.
3. Rewrite the JavaScript code so it takes the case where these controls don't exist into account.

Hope his helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote