Solved

Date Picker Not Working Inside A FormView But Does When Not In A FormView -- Urgent 500 points

Posted on 2006-12-01
2
371 Views
Last Modified: 2013-11-20
Hello Experts,
500 ponints question because I am on a tight project deadline and need expert assistance PLEASE..

Can anyone help me figure this out. I have date picker code that works famously in side a regular Web Form, but when I place it inside the FormView Tags inside the EditItemTemplate, I received all kinds of errror...Declaration errors first then when I dim em' that is fixed and then I get errors that pertain to WithEvents.

Any Idea why the first code below works great but when placing in inside the FormView, it will not work the same. Should I add something to the Sub....The Code is below.

GOOD CODE NO FORMVIEW:
==========================================================================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">

 <script language="VB" runat="server">
      
    Sub ibtnCal1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnCal1.Click
        cldpickdate1.Visible = True
    End Sub
    Sub cldpickdate1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cldpickdate1.SelectionChanged
        cldpickdate1.Visible = False
        Date1Textbox.Text = cldpickdate1.SelectedDate
    End Sub            
    Sub ibtnCal1End_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnCal1End.Click
        cldpickdate1End.Visible = True
    End Sub
    Sub cldpickdate1End_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cldpickdate1End.SelectionChanged
        cldpickdate1End.Visible = False
        Date1EndTextbox.Text = cldpickdate1End.SelectedDate
    End Sub
</script>
<title>Date Picker</title>
</head>
<body><center> Date Picker Not In A FormView Working Fine!
    <form id="form1" runat="server">
        <asp:TextBox ID="Date1Textbox" runat="server"
            Width="75px" ReadOnly="true" BackColor="LemonChiffon" Font-Names="Verdana" Font-Size="8pt" ForeColor="Firebrick"></asp:TextBox>
        <asp:ImageButton ID="ibtnCal1" runat="server" CausesValidation="False"
            ImageUrl="Images/calendar.gif" /><br />
            <asp:Calendar ID="cldpickdate1" runat="server" BackColor="White" BorderColor="#0066ff"
            BorderStyle="Groove" CellPadding="4" DayNameFormat="FirstLetter" Font-Names="Verdana"
            Font-Size="8pt" ForeColor="Black" Height="163px" TitleFormat="Month"
            Width="111px" Visible="False">
            <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
            <SelectorStyle BackColor="#660000" />
            <NextPrevStyle VerticalAlign="Bottom" />
            <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
            <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
            <TitleStyle BackColor="LightSteelBlue" BorderColor="Black" Font-Bold="True" ForeColor="Black" />
            <WeekendDayStyle BackColor="#FFFFCC" />
            <OtherMonthDayStyle ForeColor="#CCCCCC" />
        </asp:Calendar>
        <br />
        <br />
          <asp:TextBox ID="Date1EndTextbox" runat="server"
            Width="75px" ReadOnly="true" BackColor="LemonChiffon" Font-Names="Verdana" Font-Size="8pt" ForeColor="Firebrick"></asp:TextBox>
        <asp:ImageButton ID="ibtnCal1End" runat="server" CausesValidation="False"
            ImageUrl="Images/calendar.gif" /><br />
            <asp:Calendar ID="cldpickdate1End" runat="server" BackColor="White" BorderColor="#0066ff"
            BorderStyle="Groove" CellPadding="4" DayNameFormat="FirstLetter" Font-Names="Verdana"
            Font-Size="8pt" ForeColor="Black" Height="163px" TitleFormat="Month"
            Width="111px" Visible="False">
            <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
            <SelectorStyle BackColor="#660000" />
            <NextPrevStyle VerticalAlign="Bottom" />
            <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
            <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
            <TitleStyle BackColor="LightSteelBlue" BorderColor="Black" Font-Bold="True" ForeColor="Black" />
            <WeekendDayStyle BackColor="#FFFFCC" />
            <OtherMonthDayStyle ForeColor="#CCCCCC" />
        </asp:Calendar>
        </form>
   </center>
</body>
</html>

============================================================================

SAME CODE NOT WORKING INSIDE FORMVIEW & EDITITEMTEMPLATE:

============================================================================

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<script language="VB" runat="server">
    Sub ibtnCal1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnCal1.Click
        cldpickdate1.Visible = True
    End Sub
    Sub cldpickdate1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cldpickdate1.SelectionChanged
        cldpickdate1.Visible = False
        Date1Textbox.Text = cldpickdate1.SelectedDate
    End Sub
    Sub ibtnCal1End_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnCal1End.Click
        cldpickdate1End.Visible = True
    End Sub
    Sub cldpickdate1End_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cldpickdate1End.SelectionChanged
        cldpickdate1End.Visible = False
        Date1EndTextbox.Text = cldpickdate1End.SelectedDate
    End Sub
</script>
<title>Date Picker</title>
</head>
<body><center>
 <asp:FormView ID="FormView1" runat="server">
 <EditItemTemplate>
        <asp:TextBox ID="Date1Textbox" runat="server"
            Width="75px" ReadOnly="true" BackColor="LemonChiffon" Font-Names="Verdana" Font-Size="8pt" ForeColor="Firebrick"></asp:TextBox>
        <asp:ImageButton ID="ibtnCal1" runat="server" CausesValidation="False"
            ImageUrl="Images/calendar.gif" /><br />
            <asp:Calendar ID="cldpickdate1" runat="server" BackColor="White" BorderColor="#0066ff"
            BorderStyle="Groove" CellPadding="4" DayNameFormat="FirstLetter" Font-Names="Verdana"
            Font-Size="8pt" ForeColor="Black" Height="163px" TitleFormat="Month"
            Width="111px" Visible="False">
            <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
            <SelectorStyle BackColor="#660000" />
            <NextPrevStyle VerticalAlign="Bottom" />
            <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
            <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
            <TitleStyle BackColor="LightSteelBlue" BorderColor="Black" Font-Bold="True" ForeColor="Black" />
            <WeekendDayStyle BackColor="#FFFFCC" />
            <OtherMonthDayStyle ForeColor="#CCCCCC" />
        </asp:Calendar>
        <br />
        <br />
       
          <asp:TextBox ID="Date1EndTextbox" runat="server"
            Width="75px" ReadOnly="true" BackColor="LemonChiffon" Font-Names="Verdana" Font-Size="8pt" ForeColor="Firebrick"></asp:TextBox>
        <asp:ImageButton ID="ibtnCal1End" runat="server" CausesValidation="False"
            ImageUrl="Images/calendar.gif" /><br />
            <asp:Calendar ID="cldpickdate1End" runat="server" BackColor="White" BorderColor="#0066ff"
            BorderStyle="Groove" CellPadding="4" DayNameFormat="FirstLetter" Font-Names="Verdana"
            Font-Size="8pt" ForeColor="Black" Height="163px" TitleFormat="Month"
            Width="111px" Visible="False">
            <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
            <SelectorStyle BackColor="#660000" />
            <NextPrevStyle VerticalAlign="Bottom" />
            <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
            <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
            <TitleStyle BackColor="LightSteelBlue" BorderColor="Black" Font-Bold="True" ForeColor="Black" />
            <WeekendDayStyle BackColor="#FFFFCC" />
            <OtherMonthDayStyle ForeColor="#CCCCCC" />
        </asp:Calendar>
       </EditItemTemplate>
            </asp:FormView>
    </center>
</body>
</html>

0
Comment
Question by:Tone' Shelby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
bdunz19 earned 500 total points
ID: 18062676
I think you're in the wrong topic area mate!
0
 
LVL 9

Author Comment

by:Tone' Shelby
ID: 18068352
Thanks, I added it now to the VB.Net area instead.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 58
Turn a spreadsheet into a vba executable. 2 98
Separate into files by filename 12 91
JQuery serialize and unserialize 8 194
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question