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 October 10th, 2010, 06:40 PM
Registered User
 
Join Date: Oct 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default CSS class not recognized in ContactForm.ascx

Below is the code that i have for the contactForm.ascx control. (please note that the name of the file i have is controlform.ascx. that was a typo i had right from the time the file was created and it has worked well till now.)The CSS Class pleasewait cannot be recognized in this control. It has the green squiggly under the class name in VWD. I have added the class to the Monochrome and the DarkGrey CSS and have made sure that the class names match. However it seems that none of the classes in the CSS files are recognized in this control.

Where can i check to see why the CSS is not being referenced in this file?

Thanks in advance!

Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlForm.ascx.cs" Inherits="Controls_ControlForm" %>
<style type="text/css">
    .style1
    {
        width: 100%;
    }
    .style2
    {
        width: 288px;
    }
</style>
<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>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

<table class="style1" runat="server" id="FormTable">
    <tr>
        <td colspan="3">
            This is the contact form. Provide your contact information </td>
    </tr>
    <tr>
        <td>
            Your Name:</td>
        <td class="style2">
            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        </td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="txtName" ErrorMessage="Enter your name bro!">* Enter your name bro!</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td>
            Your email address</td>
        <td class="style2">
            <asp:TextBox ID="txtEmailAddress" runat="server"></asp:TextBox>
        </td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="txtEmailAddress" Display="Dynamic" 
                ErrorMessage="Please Enter a valid email id ">*</asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                ControlToValidate="txtEmailAddress" Display="Dynamic" 
                ErrorMessage="Please enter a valid email id" 
                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
        </td>
    </tr>
    <tr>
        <td>
            Your email adress again</td>
        <td class="style2">
            <asp:TextBox ID="txtEmailAddressConfirm" runat="server"></asp:TextBox>
        </td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                ControlToValidate="txtEmailAddressConfirm" 
                ErrorMessage="Please confirm the email id">*</asp:RequiredFieldValidator>
            <asp:CompareValidator ID="CompareValidator1" runat="server" 
                ControlToCompare="txtEmailAddress" ControlToValidate="txtEmailAddressConfirm" 
                ErrorMessage="please retype the email id">*</asp:CompareValidator>
        </td>
    </tr>
    <tr>
        <td>
            Home phone number</td>
        <td class="style2">
            <asp:TextBox ID="txtPhoneHome" runat="server"></asp:TextBox>
        </td>
        <td>
            <asp:CustomValidator ID="CustomValidator1" runat="server" 
                ClientValidationFunction="Validate Phone Numbers" Display="Dynamic" 
                ErrorMessage="Please enter the home or business phone number" 
                onservervalidate="CustomValidator1_ServerValidate">*</asp:CustomValidator>
        </td>
    </tr>
    <tr>
        <td>
            Business Phone number</td>
        <td class="style2">
            <asp:TextBox ID="txtPhoneBusiness" runat="server"></asp:TextBox>
        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            Comments</td>
        <td class="style2">
            <asp:TextBox ID="txtComments" runat="server" Height="106px" 
                TextMode="MultiLine" Width="315px"></asp:TextBox>
        </td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                ControlToValidate="txtComments" ErrorMessage="Please enter a Comment">*</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td class="style2">
            <asp:Button ID="btnSend1" runat="server" Text="Send" onclick="btnSend1_Click" />
        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td colspan="3">
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
        </td>
    </tr>
</table>
<asp:Label ID="lblMessage" runat="server" Text="Message Sent" Visible="false"></asp:Label>    

</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
  <ProgressTemplate>
    <div class="PleaseWait">
      Please Wait...
    </div>
  </ProgressTemplate>
</asp:UpdateProgress>

Last edited by avi1; October 10th, 2010 at 06:45 PM..
 
Old October 11th, 2010, 06:05 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 there,

Because this code is placed in a User Contol, Visual Studio doesn't know where to look. It doesn't know in which page or master page this User Control will be used, so you get a warning. It's just a warning though, which you can safely ignore. It should work fine at run-time.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 ContactForm.ascx Fed BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 27 November 7th, 2009 04:21 AM
css class Banishah ASP.NET 3.5 Basics 1 August 1st, 2009 03:18 AM
CSS & ASCX files not used by IIS 6.0 OldCoder BOOK: Beginning VB.NET Databases 0 March 31st, 2008 04:37 PM
CSS Class rupen CSS Cascading Style Sheets 3 April 13th, 2007 05:35 PM
CSS class Attaching NitinJoshi General .NET 1 January 24th, 2005 04:14 AM





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