Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

21 Experts available now in Live!

Get 1:1 Help Now