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

Refresh page after postback delete

Asked by Anwar
11 years ago.

how can you refresh a scheduler after a java ajax call event delete
I have a scheduler within a master page
And a context menu that has a few options
I am using the Delete option via java so I can prompt the user if they want to delete the event or not
That works fine I get the prompt and it calls a separate ajax callback via pagemethods PageMethods.dbDeleteEvent(e.value(e))

This works fine it deleted the event but how do I refresh and update the page if I hit F5 on the keyboard the event disappears my code is below I have had to set the dbdeleteevent to public shared so cannot call any of the daypilot postback calls

<DayPilot:DayPilotMenu ID="DayPilotMenu1" runat="server" ClientObjectName="dps"
MenuBackColor="White" MenuItemColor="Black" >
<DayPilot:MenuItem Action="JavaScript" Text="Delete" Command="Delete" JavaScript="var r = confirm('Are you sure you want to delete this event!');if (r == true) {PageMethods.dbDeleteEvent(e.value(e));} else {Alert('not deleted'); } "/>
<DayPilot:MenuItem Action="PostBack" Text="Refresh" Command ="Refresh"/>
<DayPilot:MenuItem Action="JavaScript" Text="Open" JavaScript="window.open('PopupOpen.aspx?id=' + e.value(),'PopupDetail', 'width=550,Height=580,top=200,left=200');" />
<DayPilot:MenuItem Action="Postback" Command="New" Text="New"/>
</DayPilot:DayPilotMenu>

<DayPilot:DayPilotScheduler ID="DayPilotScheduler1" runat="server"

DataStartField="eventstart"
DataEndField="Eventend"
DataTextField="Trailer_name"
DataValueField="id"
DataResourceField="resource_id"

ContextMenuID="DayPilotMenu1"
ContextMenuResourceID="DayPilotMenuRes"

RowHeaderColumnWidths="70"

ClientObjectName="dps"

CellGroupBy="Month"
CellDuration="1440"
Days="30"
HeightSpec="Fixed"
Height="600px"
EventHeight="60"
EventFontSize="10pt"

EventMoveHandling="PostBack"

EventResizeHandling="PostBack"

TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="openPopup(start, end, column);"

EventClickHandling="Bubble"
EventClickJavaScript="editEvent(e.value());"

AfterRenderJavaScript="afterRender(data);" HeaderDateFormat="m"
style="top: 4px; left: -21px; width: 716px; text-align: left; height: 71px;"
Width="950px" CellWidth="150"
ScrollY="0" EventEditHandling="PostBack"
ContextMenuSelectionID="DayPilotMenu1"
DataTagFields="Staff_name, Contract_no, notes, Staff_ID" BubbleID="EventBubble1"
ellBubbleID="" ShowToolTip="False" ScrollX="0"
</DayPilot:DayPilotScheduler>

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

You would have to do a manual refresh using commandCallBack(). See also here:

http://doc.daypilot.org/scheduler/commandcallback/

But it is better to use dps.eventMenuClickCallBack() instead of PageMethods:

<DayPilot:MenuItem Action="JavaScript" Text="Delete" Command="Delete" JavaScript="var r = confirm('Are you sure you want to delete this event!');if (r == true) {dps.eventMenuClickCallBack(e, 'delete');} else {Alert('not deleted'); } "/>

This will invoke EventMenuClick event on the server side. You can delete the event there and refresh the Scheduler using DataBind() and Update().

See also:
http://api.daypilot.org/daypilot-scheduler-eventmenuclickcallback/
http://doc.daypilot.org/scheduler/event-deleting/

Comment posted by Anwar
11 years ago.

Yes I tried .eventMenuClickCallBack() I have a masterpage so in visual studio my ClientObjectName="dps"
but in the rendered page its id="ctl00_SiteContentPlaceHolder_DayPilotScheduler1"

I tried dps.eventMenuClickCallBack(e, 'delete') and ctl00_SiteContentPlaceHolder_DayPilotScheduler1.eventMenuClickCallBack

but nothing happened

Comment posted by Anonymous
11 years ago.

looking at some of the tutorials the context menu is not even referenced so i cant event look how it works in that

Comment posted by Anonymous
11 years ago.

im using daypilot v 5.4 will this have a bearing on the issue

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