DayPilot Forums

DayPilot is the best open-source Outlook-like calendar control for ASP.NET.
DayPilot Pro Demo (Calendar control)
» DayPilot Pro live demo (Calendar control)
DayPilot Pro Demo (Scheduler control)
» DayPilot Pro live demo (Scheduler control)
Home » Bugs » Can't get refreshCallBack() to work in ASP.NET 3.5

Can't get refreshCallBack() to work in ASP.NET 3.5

Hello, I've recently upgraded my web from asp.net 2.0 to .net 3.5 and ran into one thing with the refreshCallBack function. I've been testing the exact same code in .net 2.0 and .net 3.5 projects now and confirmed that the problem must have something with the new framework to do.

Below is links to show my code:
Cal.aspx code
Cal.aspx.cs code

When I call refreshCallBack() from the <a href> tags onclick attribute it works fine!
But when I click the button inside the update panel and from the server method tries to trigger the refreshCallBack() method, it doesn't work anymore (Line 42 in Cal.aspx.cs)

As I said before, this works fine in .net 2.0 but stopped working in .net 3.5.
I use the latest 4.6 version of daypilot.

Any suggestions?
Jimmie Andersson - 3/10/2008 3:33:48 PM
I would try the following:

<asp:Button ID="btnAdd" runat="server" OnClientClick="javascript:dpc1.refreshCallBack(-7);" Text="This refresh should work" />

Let me know if it didn't help.
Dan Letecky - 3/12/2008 6:14:42 PM
Yes, that worked, but it doesn't solve my problem. I need to be able to call the refresh function from server side.
Like it worked before I upgraded to 3.5
Jimmie Andersson - 3/13/2008 1:15:31 PM
OK, I'll give it a try.
Dan Letecky - 3/13/2008 3:14:36 PM
Thank you very much!
Jimmie Andersson - 3/13/2008 3:25:39 PM
I've found out that calling CallBack from within the async postback was explicitly forbidden in .NET Framework 3.5. See line 486 in MicrosoftAjaxWebForms.js:

// DevDiv Bugs 125825: Do not allow callbacks to begin while an async postback is in progress to prevent EVENTVALIDATION corruption
if (!this.get_isInAsyncPostBack()) {
this._originalDoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
}
Dan Letecky - 3/29/2008 7:51:45 AM
okey thank you, But I really dont understand what they explicitly forbidden in .NET Framework 3.5.
Do you have any suggestion on how to make a workaround?

I need to change date and update the calender from server-side.
One solution I tryed before is to use postback and put the whole calender inside a update panel but I found that very slow and the client side way, calendar.refreshCallBack() is much faster!
Jimmie Andersson - 4/2/2008 3:35:58 PM
It seems that partial PostBack flag is cleared after all scripts embedded in the partial PostBack are executed. And because you embed a refreshCallBack call (which calls WebForm_DoCallBack) it is denied because the partial PostBack is still in progress.

I would try delaying the refreshCallBack a little bit (but I haven't tried it):

ScriptManager.RegisterClientScriptBlock(uplTemp, this.GetType(), "refresh", "javascript:window.setTimeout('dpc1.refreshCallBack(-7)', 100);", true);

The other options depend on why you need to call the refreshCallBack from the server-side code. Can you describe your use case a little bit?
Dan Letecky - 4/2/2008 3:44:32 PM
Oh the window.setTimeout worked great! you made my day :)
Jimmie Andersson - 4/2/2008 4:38:23 PM
Post reply