Hi,
You trying to call 2 Javascript functions one by one immediately. Both functions are calling the Web/App Server and doing server side functionality. Coming to your problem, first you are trying to call the Create ExcelCreate (Which is processing to create a new excel file), Note: its still in process from server side. Before ending this process, immediately ExcelDownload is start to execute and trying to download the file, but file not created yet. This way will not work out.
My Soultion 1: (use AJAX)
1. In server side Excel Creation method, set a session variable say "FILEPROCESS" and set the value as "false". Once file created set the "FILEPROCESS" to true.
2. Create a new server side service called StatusService, inside this services just write out the session "FILEPROCESS" value.
3. Create one global boolean variable blgFlg = false in your javascript
2. Inside ExcelCreate() - Call new Javascript method called getStatus() before calling the server side services
3. Inside the getStatus() function use Ajax to call the StatusService and set the response Text to blgFlg variable.
4. If blgFlg = false, then call setTimeout('getStatus()', 500);
5. If blgFlg = true, then call ExcelDownload()
My Soultion 2:
Instead of having 2 javascript function, use 1 javascript function and use 2 server side methods
If you have any clarifications, please continue to post ur reply
Thanks
Raju