ASP.Net 2.0
I am using a gridview wired to a detailsview to insert, update, and delete in mysoccer league schedule.
I have a niggling issue. I use a template field to display a calendar control on edit and insert. On edit, the calendar shows with the correct date selected (the date of the updateable game), no problem.
On insert, however, I want the selected date to be Todays date. When the calendar shows, Todays date is highlighted to show the current date BUT no date is selected. If the user clicks INSERT without actually clicking on a date, no date is sent to the database and the system dies. If the user actually clicks a date, no problem.
Is there a way to validate that a date was actually selected (validation controls don't work)? Or is there a way in my insertsql to insert todays date in if a valid date is not passed from the application? This would work if the user clicks insert thinking that the shaded Today is actually selected (it isn't).
Is there a work around using parameters?
Here is the calendar:
<asp:Calendar ID="Calendar2" runat="server" BackColor="White" BorderColor="#999999"
CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="Black" Height="180px" SelectedDate='<%# Bind("TheDate") %>' Width="200px" ToolTip="You must select a date">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="Gray" />
<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>
I am trying to migrate from Classic ASP to .net and it is frustrating but every now and then there is a wow factor with this .net stuff.
Struggling along.
Thanks
Vince Stack
Start Free Trial