ddrake
Technical User
- Mar 19, 2003
- 92
Can anyone help me figure this out. I have date picker code that works famously inside a regular Web Form, but when I place it inside the FormView Tags inside the EditItemTemplate, when clicking the calendar by the textbox it will not pop up.
Any Idea why the code below works great in a regular form but when placing in inside the FormView EditItemTemplate, it will not work the same. Should I add something to the Sub....My Good Code is below.
'==========================================================================
GOOD CODE WHEN NOT IN A FORMVIEW - BUT WHEN ADDING IT TO A FORMVIEW EDITITEMTEMPLATE - The Calendar Wont' Pop --- Why? Please.....
'==========================================================================
<%@ Page Language="VB" Trace="false" aspCompat="True" SmartNavigation="True" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace ="System.Drawing"%>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls"%>
<html xmlns=" >
<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>
<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>
Any Idea why the code below works great in a regular form but when placing in inside the FormView EditItemTemplate, it will not work the same. Should I add something to the Sub....My Good Code is below.
'==========================================================================
GOOD CODE WHEN NOT IN A FORMVIEW - BUT WHEN ADDING IT TO A FORMVIEW EDITITEMTEMPLATE - The Calendar Wont' Pop --- Why? Please.....
'==========================================================================
<%@ Page Language="VB" Trace="false" aspCompat="True" SmartNavigation="True" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace ="System.Drawing"%>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls"%>
<html xmlns=" >
<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>
<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>