This is regarding the issue in export functionality with Asynchronous call in MVC3 ASP.NET.
1) Below is the export method will be invoked during our asynchronous call.
<HttpPost()>
Function ExportHomeAccountGroup(ByVal model As Home, ByVal formdata As FormCollection) As ActionResult
Dim array As Byte()
model = New Home
array = _sourceFacade.ExportAccountGroupList(model.Input)
Dim csvFile As FileContentResult = File(array, _fileType, _fileNameAccountGrp)
Return csvFile
End Function
2) Below is the script which will invoke the export method:
$("#btnExport").click(function () {
$.ajax({
url: '/Home/ExportHomeAccountGroup',
type: 'post',
data: dataForm,
cache: false,
datatype: 'html',
success: function (updatedHtml) {
updateView("DivExport", updatedHtml);
}
});
});
We are unable to get the “Open or Save” after the csv file is returned. Is this because of the full view is not rendered while the CSV file is returned?.
Note: We are able to achieve this functionality thru Synchronous call. However we have to perform this thru Asynchronous call as per the requirement.
Please help us resolving this issue
Thanks -Subash
1) Below is the export method will be invoked during our asynchronous call.
<HttpPost()>
Function ExportHomeAccountGroup(ByVal model As Home, ByVal formdata As FormCollection) As ActionResult
Dim array As Byte()
model = New Home
array = _sourceFacade.ExportAccountGroupList(model.Input)
Dim csvFile As FileContentResult = File(array, _fileType, _fileNameAccountGrp)
Return csvFile
End Function
2) Below is the script which will invoke the export method:
$("#btnExport").click(function () {
$.ajax({
url: '/Home/ExportHomeAccountGroup',
type: 'post',
data: dataForm,
cache: false,
datatype: 'html',
success: function (updatedHtml) {
updateView("DivExport", updatedHtml);
}
});
});
We are unable to get the “Open or Save” after the csv file is returned. Is this because of the full view is not rendered while the CSV file is returned?.
Note: We are able to achieve this functionality thru Synchronous call. However we have to perform this thru Asynchronous call as per the requirement.
Please help us resolving this issue
Thanks -Subash
No comments:
Post a Comment