Hi
I have the ajaxuploadaattachments control added to a page.
I start the upload manually on button Save Click
But when no items are selected in the uploader the code behind the button will not fire.
When I do select itemsto be uploaded the code behind will fire.
aspx code:
- <script type="text/javascript">
-
- function submitbutton_click() {
- var submitbutton = document.getElementById('<%=btnSave.ClientID %>');
- var uploadimg = document.getElementById('<%=uplFiles.ClientID %>');
- if (!window.filesuploaded) {
- if (uploadimg.getqueuecount() > 0) {
- uploadimg.startupload();
- }
- else {
-
- submitbutton.click();
- }
- return false;
- }
- window.filesuploaded = false;
- return true;
- }
-
- function CuteWebUI_AjaxUploader_OnError(msg) {
- alert("Algemene fout:" + msg);
- return false;
- }
- function CuteWebUI_AjaxUploader_OnTaskError(obj, msg, reason) {
- alert("Bestandfout:" + obj.FileName + " , " + msg);
- return false;
- }
-
- function CuteWebUI_AjaxUploader_OnPostback() {
- window.filesuploaded = true;
- var submitbutton = document.getElementById('<%=btnSave.ClientID %>');
- submitbutton.click();
- return false;
- }
- </script>
The button code:
- <asp:Button runat="server" ID="btnSave" Text="Wijzigen" OnClick="btnSave_Click" OnClientClick="return submitbutton_click()" />
The control code:
- <cc2:UploadAttachments ID="uplFiles" runat="server" ManualStartUpload="true"
- MaxFilesLimit="5" FileTooLargeMsg="Bestand is te groot! Max. 5 MB."
- MultipleFilesUpload="true" ShowProgressInfo="false" ShowProgressBar="false" InsertText="Kies uw bestanden"
- MaxFilesLimitMsg="U mag maximaal 5 bestanden uploaden" RemoveButtonText="Verwijder" ShowTableHeader="false"
- ShowFileIcons="true" CancelAllMsg="Verwijder alles">
- <ValidateOption MaxSizeKB="5120" AllowedFileExtensions="pdf,doc,docx,xls,xls,rtf,txt" />
- </cc2:UploadAttachments>
Please help.