Hi Terry,
Thanks for your reply.
The changes i made shouldnt affect the OnUploadCompleted method. I only changed the UI arround the uploader and added the following BLOCKED SCRIPT
function CuteWebUI_AjaxUploader_OnStop() {
var submit = document.getElementById('<%=btSubmit.ClientID %>');
var cancel = document.getElementById('<%=btCancelUpload.ClientID %>');
var span = document.getElementById('<%=span_upload.ClientID %>');
span.removeChild(submit);
span.removeChild(cancel);
span.appendChild(submit);
span.appendChild(cancel);
var hidden = this;
hidden.internalobject.insertBtn.style.display = '';
document.getElementById('<%=btSubmit.ClientID %>').style.visibility = 'visible';
}
function CuteWebUI_AjaxUploader_OnInitialize() {
var uploader = document.getElementById("<%=AjaxUpload.ClientID %>");
uploader.handlequeueui = myqueueuihandler;
}
function myqueueuihandler(list) {
// if (list.length < 2) {
// document.getElementById('<%=queuediv.ClientID %>').style.display = "none";
// }
// else {
document.getElementById('<%=queuediv.ClientID %>').style.display = "";
var container = document.getElementById('<%=queuedivtablecontainer.ClientID %>');
container.innerHTML = "";
var table = document.createElement("table");
table.style.borderCollapse = "collapse";
table.cellSpacing = 0;
table.cellPadding = 4;
table.border = 1;
table.borderColor = "darkgreen";
for (var i = 0; i < list.length; i++) {
if (list[i].Status != 'Error') {
var name = list[i].FileName;
var size = list[i].FileSize; // (or -1)
var stat = list[i].Status; // Finish|Error|Upload|Queue
var func = list[i].Cancel;
var row = table.insertRow(-1);
row.insertCell(-1).innerHTML = name;
var last = row.insertCell(-1);
if (stat == "Queue") {
var btn = document.createElement("A");
btn.href = "BLOCKED SCRIPTvoid(0)";
btn.onclick = func;
btn.innerHTML = "Abbrechen";
last.appendChild(btn);
} else {
last.innerHTML = stat;
}
}
}
container.appendChild(table);
//}
return false; //hide the default;
}
function cancelalltasks() {
var uploader = document.getElementById("<%=AjaxUpload.ClientID %>");
uploader.cancelall();
}
The JavaScript I already had before is this:
function submitbutton_click() {
if (!ValidatorOnSubmit())
return false;
var uploadobj = document.getElementById('<%=AjaxUpload.ClientID %>');
if (uploadobj.getqueuecount() == 0)
return false;
try {
var submit = document.getElementById('<%=btSubmit.ClientID %>');
var cancel = document.getElementById('<%=btCancelUpload.ClientID %>');
var span = document.getElementById('<%=span_upload.ClientID %>');
submit.style.visibility = 'hidden';
cancel.style.visibility = 'visible';
span.removeChild(submit);
span.removeChild(cancel);
span.appendChild(cancel);
span.appendChild(submit);
} catch(e) {
alert(e);
}
if (!window.filesuploaded) {
if (uploadobj.getqueuecount() > 0) {
uploadobj.startupload();
}
return false;
}
window.filesuploaded = false;
return true;
}
function CuteWebUI_AjaxUploader_OnPostback() {
window.filesuploaded = true;
var submitbutton = document.getElementById('<%=btSubmit.ClientID %>');
submitbutton.click();
return false;
}