troubleshooting Question

2 calendars in one page

Avatar of gianitoo
gianitoo asked on
ASP.NETVisual Basic.NET
4 Comments1 Solution409 ViewsLast Modified:
I have 2 calendar controls.

1 for arrival date and 1 for departure date
i am having ahard time with the second one so it only shows on image click.   also it does not look like the 1st one.  
i will paste code below so u can give me suggestions

@ Page Language="VB" SmartNavigation="True" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
   <script type="text/javascript">
       
        function displayCalendar()
        {
            var datePicker = document.getElementById('datePicker');
            datePicker.style.display = 'block';
        }
   
    </script>
       <script type="text/javascript">
       
        function display()
        {
            var div1 = document.getElementById('div1');
            div1.style.display = 'block';
        }
   
    </script>
<script type="text/javascript">  
     
    function phoneFormat(phoneNum,defaultAreaCode){
          var p = phoneNum.value
          var looksFuncky = true;
              p=p.replace("(","")
              p=p.replace(")","")
              p=p.replace(/-/g,"")
              p=p.replace(/ /g,"")

              if (isNaN(p)==false){
                    if(p.length == 10){
                          phoneNum.value = "(" + p.substring(0,3) + ") " + p.substring(3,6) + "-" + p.substring(6,10);
                          looksFuncky = false;
                    }
                         
                    if(p.length == 7){
                          phoneNum.value = "(" + defaultAreaCode + ") " + p.substring(0,3) + "-" + p.substring(3,7);
                          looksFuncky = false;
                    }
              }
            if(p.length == 0)
                looksFuncky = false;    
     
    return looksFuncky ;

}
    </script>
        <style type="text/css">
        #datePicker
        {
            display:none;
            position:absolute;
            border:solid 2px black;
            background-color:white;
        }
           #div1
        {
            display:none;
            position:absolute;
            border:solid 2px black;
            background-color:white;
        }
        .content
        {
            width:400px;
            background-color:white;
            margin:auto;
            padding:10px;
        }
        html
        {
            background-color:silver;
        }
    </style>

    <title>Memorial Day Invite</title>
    <link href="stylesheet.css" rel="stylesheet" type="text/css" />




</head>
<body >
<table width="721" height="904" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
      <tr>
            <td colspan="2">
                  <img src="images/memorialdaybanner_01.jpg" width="211" height="279" alt=""/></td>
            <td><img src="images/memorialdaybanner_02.jpg" width="297" height="279" alt=""/></td>
            <td colspan="2">
                  <img src="images/memorialdaybanner_03.jpg" width="213" height="279" alt=""/></td>
      </tr>
      <tr>
            <td background="images/memorialdaybanner_04.gif">
                  <img src="images/memorialdaybanner_04.gif" width="43" height="515" alt=""></td>
            <td colspan="3" valign="top" bgcolor="#FFFFFF"><p class="headline">Three of international motorsports&rsquo; annual crown jewels are coming this May.<br>
              Just Marketing International is pleased to invite you and a guest to choose one and join us! We will provide complete complimentary event credentials and VIP hospitality. Experience the marketing power of motorsports that has become a staple of Fortune 500 companies worldwide.</p>
              <p align="left" class="headline">DATE: Sunday, May 27, 2007<br>
                <br>
                REGISTER BELOW IN OUR ONLINE WEB FORM <br>
              <br>
              </p>
              <table width="100%" border="0">
            <tr>
              <td width="25%" valign="top"><div align="center"><img src="images/formula1.jpg" width="176" height="113"></div></td>
              <td width="75%" valign="middle" class="headlinenotbold"><span class="headline">Grand Prix de Monaco</span><br>
                Formula One World Championship<br>
              Principality of Monaco</td>
            </tr>
            <tr>
              <td valign="top"><div align="center"><img src="images/indycar.jpg" width="154" height="124"></div></td>
              <td valign="middle" class="headlinenotbold"><span class="headline">91st Annual Indianapolis 500</span><br>
                IndyCar<br>
              Indianapolis Motor Speedway - Indianapolis, Indiana</td>
            </tr>
            <tr>
              <td valign="top"><div align="center"><img src="images/nextel.jpg" width="155" height="119"></div></td>
              <td valign="middle" class="headlinenotbold"><span class="headline">Coca-Cola 600</span><br>
                NASCAR Nextel Cup Series<br>
              Lowe&rsquo;s Motor Speedway - Charlotte, North Carolina</td>
            </tr>
          </table>
              <p class="headline">&nbsp;</p>
              <form id="form1" runat="server"><div>
   <table width="100%" border="0" cellspacing="2" cellpadding="1">
       <tr>
           <td width="179" class="Panels" style="width: 140px">
               Select Event</td>
           <td class="OptionFields" width="415">
               <asp:DropDownList ID="events" runat="server" DataSourceID="SqlDataSource3" DataTextField="EventName" DataValueField="EventName">
               </asp:DropDownList>&nbsp;
              <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="events"
                   ErrorMessage="Event is required"></asp:RequiredFieldValidator></td>
       </tr>
        <tr>
          <td class="Panels" style="width: 140px">First Name</td>
          <td width="415" class="OptionFields"><asp:TextBox ID="firstname" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="First Name is required" ControlToValidate="firstname"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
          <td class="Panels" style="width: 140px">Last Name</td>
          <td class="OptionFields"><asp:TextBox ID="lastname" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="last name is required" ControlToValidate="lastname"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
          <td class="Panels" style="width: 140px">Email Address</td>
          <td class="OptionFields"><asp:TextBox ID="email" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="email"
            ErrorMessage="a valid email address is required" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator></td>
        </tr>
        <tr>
          <td class="Panels" style="width: 140px">Phone Number</td>
          <td class="OptionFields"><asp:TextBox ID="phoneNumber" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="phoneNumber"
            ErrorMessage="A phone number is required  " ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"></asp:RegularExpressionValidator></td>
        </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               Work Phone</td>
           <td class="OptionFields" style="height: 17px">
               <asp:TextBox ID="workphone" runat="server"></asp:TextBox></td>
       </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               Cell Phone</td>
           <td class="OptionFields" style="height: 17px">
               <asp:TextBox ID="cellphone" runat="server"></asp:TextBox></td>
       </tr>
        <tr>
          <td class="Panels" style="width: 140px">Address</td>
          <td class="OptionFields"><asp:TextBox ID="address" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="address is required" ControlToValidate="address"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
          <td class="Panels" style="width: 140px">City</td>
          <td class="OptionFields"><asp:TextBox ID="city" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="city is required" ControlToValidate="city"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
          <td class="Panels" style="width: 140px">Zip</td>
          <td class="OptionFields"><asp:TextBox ID="zip" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="zip"
            ErrorMessage="zip code is required" ValidationExpression="\d{5}(-\d{4})?"></asp:RegularExpressionValidator></td>
        </tr>
        <tr>
          <td class="Panels" style="height: 17px; width: 140px;">State or Province</td>
          <td class="OptionFields" style="height: 17px">
              <asp:TextBox ID="state" runat="server"></asp:TextBox></td>
        </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               Country</td>
           <td class="OptionFields" style="height: 17px">
               <asp:DropDownList ID="country" runat="server">
                <asp:ListItem></asp:ListItem>
                   <asp:ListItem>USA</asp:ListItem>
                   <asp:ListItem>Canada</asp:ListItem>
                   <asp:ListItem>France</asp:ListItem>
                   <asp:ListItem>Germany</asp:ListItem>
                   <asp:ListItem>Japan</asp:ListItem>
                   <asp:ListItem>Netherlands</asp:ListItem>
                   <asp:ListItem>Switzerland</asp:ListItem>
                   <asp:ListItem>United Kingdom</asp:ListItem>
               </asp:DropDownList></td>
       </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               T-shirt Size</td>
           <td class="OptionFields" style="height: 17px">
               <asp:DropDownList ID="tshirt" runat="server">
                <asp:ListItem></asp:ListItem>
                   <asp:ListItem>XXL</asp:ListItem>
                   <asp:ListItem>XL</asp:ListItem>
                   <asp:ListItem>L</asp:ListItem>
                   <asp:ListItem>M</asp:ListItem>
                   <asp:ListItem>S</asp:ListItem>
               </asp:DropDownList></td>
       </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               Assistant Name</td>
           <td class="OptionFields" style="height: 17px">
               <asp:TextBox ID="assistant" runat="server"></asp:TextBox></td>
       </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               Assistant Phone</td>
           <td class="OptionFields" style="height: 17px">
               <asp:TextBox ID="assistantphone" runat="server"></asp:TextBox></td>
       </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               Assistant Email</td>
           <td class="OptionFields" style="height: 17px">
               <asp:TextBox ID="assistantemail" runat="server"></asp:TextBox></td>
       </tr>
       <tr>
           <td class="Panels" colspan="1" style="height: 17px">
               Intended Arrival Date</td>
           <td class="OptionFields" style="height: 17px" colspan="2">    
   
    <asp:TextBox
        id="txtEventDate"
        Runat="server" />
    <img src="Calendar.gif" onclick="displayCalendar()" />
   
    <div id="datePicker">
    <asp:Calendar
        id="calEventDate"
        OnSelectionChanged="calEventDate_SelectionChanged"
        Runat="server" /> </div>

              </td>
       </tr>
       <tr>
           <td class="Panels" style="width: 140px; height: 17px">
               Intended Departure Date</td>
           <td class="OptionFields" style="height: 17px">
                 <asp:TextBox
        id="txtEvent"
        Runat="server" />
    <img src="Calendar.gif" onclick="display()" />
   
    <div id="Div1">
    <asp:Calendar
        id="Calendar1"
        OnSelectionChanged="Calendar1_SelectionChanged"
        Runat="server" /> </div></td>
       </tr>
        <tr>
          <td colspan="2" style="text-align: right">&nbsp;
              <asp:ImageButton ID="submit" runat="server" ImageUrl="~/images/submit.jpg" /></td>
          </tr>
      </table>
      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:db1ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:db1ConnectionString.ProviderName %>"  InsertCommand="INSERT INTO [reg] ( [EventType], [Firstname], [Lastname], [Email], [Phonenumber], [Workphone], [Cellphone], [Address], [City], [Zip], [State], [Country], [Tshirt], [Assistant], [AssistantPhone], [AssistantEmail], [Arrival], [Departure]) VALUES (@EventType,@Firstname, @Lastname, @Email, @Phonenumber, @workphone, @cellphone, @Address, @City, @Zip, @State, @country, @Tshirt, @Assistant, @AssistantPhone, @AssistantEmail, @Arrival, @Departure)" >
        <InsertParameters>
         
                 <asp:FormParameter  FormField="events" Name="EventType" Type="String" />
              <asp:FormParameter FormField="firstname" Name="Firstname" Type="String" />
              <asp:FormParameter FormField="lastname" Name="Lastname" Type="String" />
              <asp:FormParameter FormField="email" Name="Email" Type="String" />
              <asp:FormParameter FormField="phonenumber" Name="Phonenumber" Type="String" />
                <asp:FormParameter  FormField="Workphone"  Name="Workphone" Type="String" />
               <asp:FormParameter  FormField="Cellphone"  Name="Cellphone" Type="String" />
              <asp:FormParameter FormField="Address" Name="Address" Type="String" />
              <asp:FormParameter FormField="city" Name="City" Type="String" />
              <asp:FormParameter FormField="zip" Name="Zip" Type="String" />
              <asp:FormParameter FormField="state" Name="State" Type="String" />
            <asp:FormParameter  FormField="Country"  Name="Country" Type="String" />
             <asp:FormParameter  FormField="Tshirt"  Name="Tshirt" Type="String" />
               <asp:FormParameter  FormField="Assistant"  Name="Assistant" Type="String" />
           <asp:FormParameter  FormField="AssistantPhone"  Name="AssistantPhone" Type="String" />
             <asp:FormParameter  FormField="AssistantEmail"  Name="AssistantEmail" Type="String" />
               <asp:FormParameter  FormField="txtEventDate" Name="Arrival" Type="DateTime" />
              <asp:FormParameter  FormField="txtEvent"  Name="Departure" Type="DateTime" />
       
        </InsertParameters>
      </asp:SqlDataSource>
     
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:db1ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:db1ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [events]"> </asp:SqlDataSource>
    </div>
    </form></td>
            <td background="images/memorialdaybanner_06.gif">
                  <img src="images/memorialdaybanner_06.gif" width="49" height="515" alt=""></td>
      </tr>
      <tr>
            <td colspan="5">
                  <img src="images/memorialdaybanner_07.gif" width="721" height="109" alt=""></td>
      </tr>
      <tr>
            <td>
                  <img src="images/spacer.gif" width="43" height="1" alt=""></td>
            <td>
                  <img src="images/spacer.gif" width="168" height="1" alt=""></td>
            <td>
                  <img src="images/spacer.gif" width="297" height="1" alt=""></td>
            <td>
                  <img src="images/spacer.gif" width="164" height="1" alt=""></td>
            <td>
                  <img src="images/spacer.gif" width="49" height="1" alt=""></td>
      </tr>
</table>
<div align="center">
  <!-- End ImageReady Slices -->
</div>

</body>
</html>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros