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

Navigator loses customisation on time range selected changes

Asked by Pete
1 day ago.

Two things I am having issues with:

1) When I select a new time range on the navigator, it loses the customisation I have setup on the BeforeCellRender.

2) How can you update the navigator through javascript? I have tried using the nav.update(), but it comes up with the error in screenshot 3.

Javascript

let nav = new DayPilot.Navigator("dpnSelection");
console.log(nav);
nav.update();

Nav declaration

<DayPilot:DayPilotNavigator ID="dpnSelection" runat="server" ClientIDMode="Static" 
ShowMonths="3" SelectMode="Week" CellHeight="25" CellWidth="25" 
OnBeforeCellRender="Selection_BeforeCellRender" 
OnTimeRangeSelected="Selection_TimeRangeSelected" TimeRangeSelectedHandling="Postback" />
Answer posted by Dan Letecky [DayPilot]
1 day ago.

1. This should work fine. On PostBack, the TimeRangeSelected event is called for every cell and the values are updated on the client side.

You can test it in the Calendar/Navigator.aspx demo page:

If you modify Calendar/Navigator.aspx.cs like this, you will see the custom HTML after TimeRangeSelected event PostBack as well.

protected void DayPilotNavigator1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.Navigator.BeforeCellRenderEventArgs e)
{
    e.InnerHTML = e.Start.Day + "*";
}

2. The client-side object is already available as dpnSelection (for your ID and ClientIDMode values; you can also set it explicitly using ClientObjectName="dpnSelection"):

dpnSelection.update();
Comment posted by Pete
23 hours ago.

1) I was already doing all of that, but I figured out why it wasn’t working and fixed it.

2) Should the Navigator.update() be firing the BeforeCellRender? As when I now do it using dpnSelection.update() it does not fire any errors, but it doesn’t seem to be updating.

Comment posted by Dan Letecky [DayPilot]
22 hours ago.

Thanks for the update.

Calling update() on the client-side doesn’t invoke a server-side update. You’d have to invoke a PostBack, e.g. by calling __doPostBack() for a hidden Button element and then call DayPilotNavigator.Update() in the server-side event handler.

New Reply
This reply is
Attachments:
or drop files here
Your name (optional):