Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pull data with calendar control

Status
Not open for further replies.

skw8966

Programmer
Apr 12, 2001
59
US
I'm using Visual Web Developer 2008.

I'd like to pull a week of data by using a calendar control.

I have a calendar control and a gridview with a datasource tied to the calendar.

When I select last week, it just shows Monday's data. When I select another week, it shows nothing. Every day has data though.

Can someone point me in the right direction?

here's the code:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="WeeklyCount.aspx.vb" Inherits="WeeklyCount" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns="<head runat="server">
<title>Weekly Count</title>
<asp:Literal ID="Literall" runat="server"></asp:Literal>
</head>
<body>
<form id="frmCalendar" runat="server">
<asp:Calendar ID="Calendar1" runat="server" BackColor="#FFFFCC"
BorderColor="#FFCC66" BorderWidth="1px" DayNameFormat="Shortest"
Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="200px"
SelectionMode="DayWeek" ShowGridLines="True" Width="220px">
<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
<SelectorStyle BackColor="#FFCC66" />
<TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#CC9966" />
<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
<DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
<TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt"
ForeColor="#FFFFCC" />
</asp:Calendar>
<br />
<asp:GridView ID="GridView1" runat="server" DataSourceID="AccessDataSource1">
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/OrderCount.mdb"
SelectCommand="SELECT [RecDate], [Accessories], [BlankStock], [Other], [POD], [Engraving], [RowTotal], [Ribbons], [Offset], [Napkins], [Matches] FROM [qry3McWkCountRevised] WHERE ([RecDate] = ?)">
<SelectParameters>
<asp:ControlParameter ControlID="Calendar1" Name="RecDate"
PropertyName="SelectedDate" Type="DateTime" />
</SelectParameters>
</asp:AccessDataSource>
</form>

</body>
</html>

Thanks,
Steve
 
1. never use datasource controls. you cannot debug them.
2. your sql query will only pull data for 1 date, not a range of dates.
3. use CSS to style your controls.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top