I have a client callback function that calls a webservice in a codebehind page and UPDATES a record in a database.
The return from the webservice is a string value that tells the user whether the UPDATE was successful.
----------------------------------------------------------------------
The Javascript
----------------------------------------------------------------------
function UpdateStatus()
{
var context = '';
var message = 'UpdateStatus' + '~' + document.all.txtConHandle.value + '~' + document.all.hdnStatus.value;
<%= mUpdateStatus %>
<%= mGetQDataCallBack %>
}
----------------------------------------------------------------------
The Callback event reference
----------------------------------------------------------------------
mUpdateStatus = this.ClientScript.GetCallbackEventReference(this, "message", "UpdateQMessage", "context", true);
mGetQDataCallBack = this.ClientScript.GetCallbackEventReference(this, "message", "BuildQTable", "context",true);
----------------------------------------------------------------------
The RaiseCallbackEvent method
----------------------------------------------------------------------
public string eventArg;
public void RaiseCallbackEvent(string eventArg)
{
this.eventArg = eventArg;
}
----------------------------------------------------------------------
The GetCallbackResult method
----------------------------------------------------------------------
public string GetCallbackResult()
{
if(delete)
string deleteStatus = qmWS.DeleteStudies(someValue);
return deleteStatus;
}
else if(refresh){
string xmlStudies = qmWS.GetXMLStudiesByQueueName(someValue);
return xmlStudies;
}
The problem is that when the UPDATE succeeds, I need to call another ClientCallback function to refresh the data. I think that part of the problem is the callback is asynchronous, however I'm not too sure.
Regardless, The refresh logic isn't working after <%= mUpdateStatus %> is called.
The application goes into an endless loop.
Do I need to check for the XMLHTTP Status before I do the refresh Logic?
How Can I fix this?
Thanks.
Doug Dexter