Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 25th, 2010, 10:06 AM
Authorized User
Points: 350, Level: 6
Points: 350, Level: 6 Points: 350, Level: 6 Points: 350, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Location: Eastern Michigan-Near Canada
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default Ch 9-MessageBox Not Popping Up

In Ch. 9 p 312, I have set the Validation Summary control to ShowMessageBox to True and ShowSummary to False. I click on the blank form and the web page blinks as it processed on my local server, but all I get are the red asterisks. If I then change the ShowSummary back to true, leaving the ShowMessageBox also to true, I get the inline list with thde added HeaderText Title.

So I'm not getting a message box to show on the page? ;-)
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill
Reply With Quote
  #2 (permalink)  
Old August 25th, 2010, 12:02 PM
Imar's Avatar
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

Hi there,

"the web page blinks" seems to indicate that the client side behavior is not kicking in, and validation is carried out at the server only. The messagebox works client side only. A few possible causes:

1. Your browser has JavaScript disabled.

2. You disabled client script for the validation controls

3. Some error in custom validation / JavaScript may prevent the client validation from functioning.

Can any of these be the case? If not, can you post the code for the page / control?

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
The Following User Says Thank You to Imar For This Useful Post:
btcomp (August 25th, 2010)
  #3 (permalink)  
Old August 25th, 2010, 01:16 PM
Authorized User
Points: 350, Level: 6
Points: 350, Level: 6 Points: 350, Level: 6 Points: 350, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Location: Eastern Michigan-Near Canada
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Cool

Quote:
Your browser has JavaScript disabled
I do use Noscript, but I leave JavaScript on


Quote:
"the web page blinks" seems to indicate that the client side behavior is not kicking in
Well I redid the code, but boy you have to be careful, because the controls are registered and I was getting build errors. So I deleted the control AND removed the registration for it in the Contact.aspx form markup. It doesn't do this when you delete the user control!

Well I put your control code in ContactForm.ascx and ContactForm.ascx.cs because mine was 'acting up' and I guess I didn't want to redo the whole form over again with the validation objects.

Well it still was not giving me a MessageBox. hmmmm. But the flicker was gone and the client side kicked in and gave me the JavaScript error inline message and the red asterisks.

So I went and made ShowMessageBox True and ShowSummary False. Still running the client side code, still no MessageBox. So you said:


Quote:
2. You disabled client script for the validation controls
And then I looked at the ValidationSummary properies and the enabled properties and noticed that one just called 'Enabled' was false. hmmm again. It's tool tip is 'Enable state of the control'.

So I set it to True and then ran. The 'MessageBox' ran. SUCCESS!!!

So below is the code first from your file on Wrox website and then the one where I have set the Enabled state to true.

Code:
<asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="ErrorMessage" HeaderText="Please correct the following errors before you press the Send button:" />
    </td>
  </tr>
</table>
<asp:Label ID="Message" runat="server" Text="Message Sent" Visible="False" />

Now the code that works giving you the MessageBox window.

Code:
<asp:ValidationSummary ID="ValidationSummary1" runat="server" 
        CssClass="ErrorMessage" 
        HeaderText="Please correct the following errors before you press the Send button:" 
        ShowMessageBox="True" ShowSummary="False" />
    </td>
  </tr>
</table>
<asp:Label ID="Message" runat="server" Text="Message Sent" Visible="False" />
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill

Last edited by btcomp; August 25th, 2010 at 01:18 PM..
Reply With Quote
  #4 (permalink)  
Old August 25th, 2010, 01:22 PM
Imar's Avatar
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

Glad you got it fixed.

I don't see Enabled="True" in the code you posted so I assume you took it out. That works equally well, as its default value is True. When you add a control to the page, the Enabled property is not added to the markup (and thus defaults to True), so somewhere somehow you turned the Enabled property off. This may happen when you double-click the property or its value in the Properties Grid for example.....

Cheers.

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
  #5 (permalink)  
Old August 25th, 2010, 02:10 PM
Authorized User
Points: 350, Level: 6
Points: 350, Level: 6 Points: 350, Level: 6 Points: 350, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Location: Eastern Michigan-Near Canada
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default

I may have turned off the Enabled. Not sure. But at least I know it's there. I didn't actually take out the Enabled= True, it doesn't show, but if it's False it does, and then the MessageBox doesn't appear. But I know that it needs to be True or it doesn't matter what the MessageBox is 'True' or 'False'. Hopefully others don't have this problem, but just toggle the Enabled to 'True' if it's 'False'.
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill
Reply With Quote
  #6 (permalink)  
Old August 25th, 2010, 03:05 PM
Imar's Avatar
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

Unlike some other controls, the ValidationSummary doesn't submit itself to the cllient when it's not enabled, and thus it can never do what it's designed to do.

The VWD designer is smart enough to figure out that True is the default, and thus removes the attribute from the markup when you change it from False to True.

Cheers,

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
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 9-but will learn more abt User Controls (ch 8) btcomp BOOK: Beginning ASP.NET 4 : in C# and VB 1 August 24th, 2010 11:40 AM
Search ch 13, ch 16 sporik BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 0 October 27th, 2009 04:44 PM
How Can I Keep This Error Message From Popping Up Ben Horne Access VBA 5 March 24th, 2009 11:14 AM
MessageBox help Barkils C# 1 July 16th, 2007 09:30 PM
can't get messagebox example in ch 18 to work itlotl VB.NET 2002/2003 Basics 3 January 13th, 2006 04:39 PM



All times are GMT -4. The time now is 11:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.