View Single Post
  #1 (permalink)  
Old Jan 30th, 2008, 21:06
Aspnoober Aspnoober is offline
New Member
Join Date: Jan 2008
Location: uk
Age: 41
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Calender Control help (Possibly easy)

Ok heres a problem thats been bugging me for sometime, but magaed to put it off as I had other stuff to program.

I'm using a Callender control in ASP.NET to display some data from a SQL table.

My current code is
Code: Select all
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"></asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:default %>" SelectCommand="select message from myTable where day_date = @day_date">
<SelectParameters>
<asp:ControlParameter Name="day_date" Type="DateTime" ControlID="Calendar1" PropertyName="SelectedDate" />
</SelectParameters>
</asp:SqlDataSource>
Now this code works but I need it to work in weeks instead of days so to speak. So the data would show for 7 days instead of just that 1 day (for example Monday - Sunday). My only thoughts would be to make the database hold 7 rows of dates, however that may be impractical as other users may need to change the dates once in a while.
Can anyone think of an easy way to do this? Or am I going to need to use a hella of lot more code.

Any help would be appreciated.
Reply With Quote