Solved

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

Posted on 2006-12-01
2
364 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now