At some point you are using the GetCallbackEventReference method to obtain the script necessary for the client to perform a callback. Typically how you handle this is by adding a client side event handler...
mycontrol.Attributes.Add("onclick", GetCallbackEventReference(...))
One option is to have your code be prefixed by your showing the image
mycontrol.Attributes.Add("onclick", "showWaitImage();" & GetCallbackEventReference (...))
Another option to send down the callback script in a variable RegisterClientVariable and obtain the script client side via dnn.getVar. Then simply perform an eval on it...
ServerSide
RegisterClientVariable(Me.Page, "myCallbackScript", GetCallbackEventReference (...), True)
mycontrol.Attributes.Add("onclick", "doMyCallback();")
Client Side
function doMyCallback()
{
var sCallback = dnn.getVar('myCallbackScript');
dnn.dom.getById('myworkimageid').style.display='';
eval(sCallback);
}
function callbackSuccess(result, ctx)
{
dnn.dom.getById('myworkimageid').style.display='none';
//do something with results...
}
With that said, probably the easiest option is to simply specify a status function when invoking the GetCallbackEventReference.
function callbackStatus(result, ctx)
{
if (isNaN(result))
dnn.dom.getById('myworkimageid').style.display='none'; //complete
else
dnn.dom.getById('myworkimageid').style.display='';
}
With that said, please note that I am only providing this info from the top of my head, the syntax may have errors, but hopefully you get the idea.