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

RowHeaderColumn change after EventResize

Asked by Davide
7 years ago.

Hi,
I would like to change the HTML content of a specific column using this code for my Scheduler:

Public Sub dpCalendar_EventResize(sender As Object, e As DayPilot.Web.Ui.Events.EventResizeEventArgs) Handles dpCalendar.EventResize
Me.dpCalendar.Resources.FindById(e.Resource).Columns(0).Html = 20
End Sub

but always remains the same value until page refresh.
What can I do? Is it possible to add a column on the left panel (RowHeaderColumn) with the time length of his resource by another way?

Thank you.
Davide

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

It should update properly if you force a full refresh by calling Update():

Public Sub dpCalendar_EventResize(sender As Object, e As DayPilot.Web.Ui.Events.EventResizeEventArgs) Handles dpCalendar.EventResize 
  Me.dpCalendar.Resources.FindById(e.Resource).Columns(0).Html = 20 
  Me.dpCalendar.Update(CallBackUpdateType.Full);
End Sub

Let me know if it didn't help.

Comment posted by Davide
7 years ago.

Hi!
It works thanks!!!! The RowHeaderColumn is update correctly. But now, after resize event all cells are empty!
The column is updated but I lose all data. What I'm doing wrong?

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

By default, events are not stored anywhere so you need to reload them (use DataSource and DataBind just like in Page_Load):

Public Sub dpCalendar_EventResize(sender As Object, e As DayPilot.Web.Ui.Events.EventResizeEventArgs) Handles dpCalendar.EventResize 
  Me.dpCalendar.Resources.FindById(e.Resource).Columns(0).Html = 20 
  Me.dpCalendar.DataSource = ' ....
  Me.dpCalendar.DataBind()
  Me.dpCalendar.Update(CallBackUpdateType.Full);
End Sub

You can also store the events in the ViewState but it's not recommended because it's much slower (StoreEventsInViewState property). In that case the data binding wouldn't be necessary.

Comment posted by Davide
7 years ago.

Wow!
It works well!

Thank you.
Davide

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