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

How to bind MVC View's Navigator with Controller

Asked by Manish
3 years ago.

Hello,

I am using Navigator in my view page and i want to bind this with controller. I am not getting how to do this.

My view page code is follows:

<div class="row" id="NavigatorDiv">
<div class="col-md-12">
<div class="form-group">
@Html.DayPilotNavigator("dpn", new DayPilotNavigatorConfig
{
BackendUrl = Url.Content("~/Calendar/BackEndNavigator"),
WeekNumberAlgorithm = DayPilot.Web.Mvc.Enums.Navigator.WeekNumberAlgorithm.Auto,
WeekStarts = DayPilot.Web.Mvc.Enums.WeekStarts.Monday,
ShowMonths = 12,
SelectMode = DayPilot.Web.Mvc.Enums.Navigator.NavigatorSelectMode.Day,
RowsPerMonth = DayPilot.Web.Mvc.Enums.Navigator.RowsPerMonth.Auto,

VisibleRangeChangedHandling = DayPilot.Web.Mvc.Events.Navigator.VisibleRangeChangedHandlingType.JavaScript,
VisibleRangeChangedJavaScript = "editEvent(e)"
})
</div>
</div>
</div>

Please help me out.

Answer posted by Dan Letecky [DayPilot]
3 years ago.

The Navigator supports loading free/busy data from the endpoint specified using BackendUrl.

Please see the following doc page:
http://doc.daypilot.org/navigator/highlighting-busy-days/

You need to create the endpoint at the specified URL and create the event handler by overriding OnVisibleRangeChanged method.

VisibleRangeChangedHandling property must be set to DayPilot.Web.Mvc.Events.Navigator.VisibleRangeChangedHandlingType.CallBack.

VisibleRangeChangedJavaScript property can be removed.

Comment posted by Dan Letecky [DayPilot]
3 years ago.

Please note that hlighlighting free/busy days is only supported in the Pro version.

Comment posted by Manish
3 years ago.

Hi,

If it will work in Pro version only then how can i use navigator in light version. My requirement is just to call controller on selection of particular day.

Comment posted by Dan Letecky [DayPilot]
3 years ago.

The Navigator is not included in the MVC Lite version at the moment. You would have to switch to the Pro version or use the Navigator from the JavaScript Lite version.

There are two events related to changing the date:

1. VisibleRangeChanged gets fired when the user changes the visible month(s) using the < or > icons.
2. TimeRangeSelected gets fired when the users clicks a certain date.

It looks like you are looking for TimeRangeSelected event. Example for the Pro version:

@Html.DayPilotNavigator("dpn", new DayPilotNavigatorConfig 
{ 
  // ...
 TimeRangeSelectedHandling = DayPilot.Web.Mvc.Events.Navigator.TimeRangeSelectedHandlingType.JavaScript, 
 TimeRangeSelectedJavaScript = "alert(start + ' ' + end)" 
}) 
Comment posted by Manish
3 years ago.

Thanks a lot...

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