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

How do I connect DayPilot Navigator with DayPilot Month in VB.NET?

Asked by Roman Hultay (roman.hultay@auricnet.ca)
10 years ago.

I have tried to connect DayPilot Navigator to DayPilot Month, and have had no luck with the events firing, for some odd reason. Any help would be greatly appreciated.

When I use the Navigator to switch months, it is not firing the .Command event for some reason. AutoEventWireUp is set to 'True'.

Markup:

<!-- Report Calendar -->
<asp:UpdatePanel runat="server" UpdateMode="Always" >
<ContentTemplate>
<asp:Panel ID="pnlCalendar" runat="server" >
<div class="tab">
<h3>Calendar Preview</h3>
</div>

<!-- DayPilot -->
<dp:DayPilotNavigator ID="dpNavigator" runat="server" />
<dp:DayPilotMonth ID="dpMonth" runat="server" />
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="dpMonth" EventName="Command" />
</Triggers>
</asp:UpdatePanel>

VB.NET Code

<SNIP>

' Prepare DayPilot Navigator
dpNavigator.SelectMode = DayPilot.Web.Ui.Enums.NavigatorSelectMode.Month
dpNavigator.BoundDayPilotID = dpMonth.ID

' Bind DataSet to DayPilot Navigator
dpNavigator.DataStartField = "Start"
dpNavigator.DataEndField = "End"
dpNavigator.DataSource = ds_EmployeeAttendance
dpNavigator.DataBind()

' Prepare DayPilot
dpMonth.DataStartField = "Start"
dpMonth.DataEndField = "End"
dpMonth.DataTextField = "Name"
dpMonth.DataValueField = "ID"
dpMonth.DataTagFields = "Name"
dpMonth.EventClickJavaScript = ""
dpMonth.EventHeight = 25

' Bind DataSet to DayPilot Month
dpMonth.DataSource = ds_EmployeeAttendance
dpMonth.DataBind()
<SNIP>

Protected Sub dpNavigator_Command(ByVal sender As Object, ByVal e As DayPilot.Web.Ui.Events.Navigator.VisibleRangeChangedEventArgs) Handles dpNavigator.VisibleRangeChanged
If e.Data = "navigate" Then
dpMonth.StartDate = e.Data("start")
dpMonth.DataBind()
dpMonth.Update(DayPilot.Web.Ui.Enums.CallBackUpdateType.Full)
End If
End Sub

Comment posted by Roman Hultay (roman.hultay@auricnet.ca)
10 years ago.

Whoops, wrong event handler pasted, I was trying everything I could to get an event to fire.

Protected Sub dpMonth_Command(ByVal sender As Object, ByVal e As DayPilot.Web.Ui.Events.CommandEventArgs) Handles dpMonth.Command
If e.Data = "navigate" Then
dpMonth.StartDate = e.Data("start")
dpMonth.DataBind()
dpMonth.Update(DayPilot.Web.Ui.Enums.CallBackUpdateType.Full)
End If
End Sub

Comment posted by Dan Letecky
10 years ago.

The command is store in e.Command property so you should replace this line

If e.Data = "navigate" Then

with this line

If e.Command = "navigate" Then
Comment posted by Anonymous
10 years ago.

Greetings,

I am attempting to do the same exact thing in C# but the e arg doesn't find the .Command function to let me get the information I need.

protected void dpnSchedule_Command(object sender, DayPilot.Web.Ui.Events.Navigator.VisibleRangeChangedEventArgs e)

Am I missing something to let me get access to the .Command information??

Answer posted by Dan Letecky
10 years ago.

I'll try to clarify:

There are two events that the Navigator control is firing:

  • VisibleRangeChanged - fires when the user clicks the < or > links in the navigator header (to switch to the next/previous set of months)
  • TimeRangeSelected - fires when the user clicks on a date cell in the navigator body

And now the trick:

  • These events are fired on the server side only if VisibleRangeChangedHandling or TimeRangeSelectedHandling respectively are set to CallBack or PostBack. Or if you invoke them manually using dpn.visibleRangeCallBack() or a similar method on the client side.
  • TimeRangeSelectedHandling has one more possible value - Bind. This is the default value and it causes that the control calls Command event of the bound DayPilot control (BoundDayPilotID) instead of DayPilotMonth.TimeRangeSelected.

You seem to be handlingVisibleRangeChanged event of the Navigator control but you might want to handle Command event of the bound control (Calendar, Scheduler, or Month).

Comment posted by Louis
9 years ago.

can you provide me with this asp.net and vb code? I have been looking for a sample like this for a week!

thanks

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