search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

need to make a month view that pulls data from a database

Asked by John
15 years ago.

I have attempted to adapt the DemoSql code to have a month view based on the data in a database. The first error I received was that the control did not have an enddate property. In the documentation I noticed that there were datastartdate and dataenddate properties which I then used for the control parameters. This time I got a problem with the data not being converted to smalldatetime. I changed the database so that every date field had date data in it but still got the same error. Does any one have a working example of a month view calendar the works with a database? Thank you.

<asp:UpdatePanel ID="UpdatePanelCalendar" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<DayPilot:DayPilotMonth ID="DayPilotCalendar1" runat="server" DataEndField="A1date"
DataStartField="A1begin" DataTextField="ctype" DataValueField="id" DataTagFields="ctype, id"
DataAllDayField="allday" OnEventMove="DayPilotCalendar1_EventMove" Days="7" EventMoveHandling="CallBack"
ContextMenuID="DayPilotMenu1" OnEventMenuClick="DayPilotCalendar1_EventMenuClick"
EventResizeHandling="CallBack" OnEventResize="DayPilotCalendar1_EventResize"
OnTimeRangeSelected="DayPilotCalendar1_TimeRangeSelected" TimeRangeSelectedHandling="HoldForever"
EventClickHandling="Edit" EventClickJavaScript="alert('Tag[&quot;ctype&quot;]: ' + e.tag('ctype'));"
EventSelectHandling="CallBack" ClientObjectName="dpc1" EventEditHandling="CallBack"
OnEventEdit="DayPilotCalendar1_EventEdit" EventDeleteHandling="JavaScript" OnEventDelete="DayPilotCalendar1_EventDelete"
EventDeleteJavaScript="if (confirm('Do you really want to delete \'' + e.text() + '\' ?')) dpc1.eventDeleteCallBack(e);"
OnEventSelect="DayPilotCalendar1_EventSelect" OnRefresh="DayPilotCalendar1_Refresh"
EventSelectColor="Blue" ShowAllDayEvents="True" AllDayEventBackColor="255, 255, 255"
BackColor="#FFFFD5" BorderColor="#000000" CellSelectColor="#316AC5" DataSourceID="SqlDataSourceEvents"
DurationBarColor="Blue" EventBackColor="#FFFFFF" EventBorderColor="#000000" HourBorderColor="#EAD098"
HourHalfBorderColor="#F3E4B1" HourNameBackColor="#ECE9D8" HourNameBorderColor="#ACA899"
NonBusinessBackColor="#FFF4BC" ScrollPositionHour="9" StartDate="2007-09-30"
ContextMenuSelectionID="menuSelection">
</DayPilot:DayPilotMonth>
<asp:SqlDataSource ID="SqlDataSourceEvents" runat="server" ConnectionString="<%$ ConnectionStrings:daypilot %>"
SelectCommand="SELECT [id], [ctype], [A1begin], [A1date], [allday] FROM [citystat] WHERE NOT (([A1date] <= @start) OR ([A1begin] >= @end + 1))">
<SelectParameters>
<asp:ControlParameter Name="start" ControlID="DayPilotCalendar1" PropertyName="StartDate" />
<asp:ControlParameter Name="end" ControlID="DayPilotCalendar1" PropertyName="DataEndField" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>

Comment posted by John
15 years ago.

I think I got it. Just needed to change the sql to use the start date plus 30

Comment posted by Dan Letecky
15 years ago.

I will be adding two new properties to DayPilotMonth to make this easier: something like VisibleStart and VisibleEnd. They would return the first and the last day of the table to make the SQL binding easier (the actual first day is usually not the first day of the month and the last one is usually not first day + 31).

These properties will be available in DayPilot Pro 5.1.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.