Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2010, 11:47 AM
Banned
 
Join Date: Jan 2010
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default ShowMessageBox does not appear

I have perfomed the 'Try it out' up to and including step 7 on page 304 and everything works as it is supposed to. What is odd is that the last 2 steps, 8 and 9 aren't working. The message box does not appear. There are only 3 small change to make. The problem must be someware else. I'f searched the forum and have see where the Java script can cause problems but that looks good to. What else can I check?
Here is the markup for the changes.


Code:
    <td class="style3" colspan="3">
      <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
        HeaderText="Please correct the following errors before you press the Send button" 
        ShowMessageBox="True" ShowSummary="False" />
    </td>
Code:
<script type="text/javascript">
  function ValidatePhoneNumbers(source, args)
  {
    var txtPhoneHome = document.getElementById('<%= txtPhoneHome.ClientID %>');
    var txtPhoneBusiness = document.getElementById('<%= txtPhoneBusiness.ClientID %>');
    if (txtPhoneHome.value != ' ' || txtPhoneBusiness.value != ' ')
    {
      args.IsValid = true;
    }
    else
    {
      args.IsValid = false
    }
  }
    
</script>
 
Old March 13th, 2010, 07:32 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Chuck,

Do you see the error message for the custom validator appear in Step 7?

Are you sure the changes were saved correctly and you requested a fresh copy of the page in the browser? Did you try reloading using Ctrl+F%?

If that doesn't help, can you post the full code of the markup and Code Behind?

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!
 
Old March 13th, 2010, 01:00 PM
Banned
 
Join Date: Jan 2010
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default Found the problem

Yes, everything displayed correctly in step 7.

I started reading the “How it works” to see if I could find the problem and I saw that I misspelled the “ValidatePhoneNumbers” ClientValidationFuntion. After I corrected that, it worked fine.

Thanks,

Chuck

Code:
    <td>
      <asp:CustomValidator ID="CustomValidator1" runat="server" 
        ClientValidationFunction="VlidatePhoneNumber" Display="Dynamic" 
        ErrorMessage="Please enter your home or business phone">* </asp:CustomValidator>
    </td>
 
Old March 14th, 2010, 06:02 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Darn strict JavaScript interpreters.... ;-)

Glad it's working now.

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!
 
Old September 23rd, 2010, 12:37 PM
Registered User
 
Join Date: Jun 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I had the same problem, useful thing these forums for us people who only type with our thumbs!!









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.