Hello,
Actually, I have some problem with the Treeview item in particular onClientContextMenuItemClicking as shown below:
Save As menu item is supposed to save resx file [RESOURCE FILE in DOTNET]; it calls a webs service to get the file from the DB, and Download the file, but the below code didn't work out in this case, but when i tried it out without Ajax or Telerick controls, I could work it out:
DownloadFile method should force the Browser to open Save Dialog File, is there anything wrong with the code above, Could you please Help.
Regards,
Hanan
Actually, I have some problem with the Treeview item in particular onClientContextMenuItemClicking as shown below:
function onClientContextMenuItemClicking(sender, args)
{ var menuItem = args.get_menuItem(); var node = args.get_node(); menuItem.get_menu().hide(); switch (menuItem.get_value()) { case "SaveAs": Xlate.Web.Translation.service.ResourceFilesService.ExportResourceFile('108', PassServiceHandler, FailServiceHandler); break; } }[WebMethod()] public void ExportResourceFile(string fileId) { List<ISearchResult> searchResults; SearchCriteria searchCriteria; try { searchCriteria = new SearchCriteria(); searchCriteria.ResourceFileID = int.Parse(fileId); searchCriteria.SearchOption = SearchType.ResxKey; ResourceFile resourceFile = ResxFileManager.CreateResourceFile(searchCriteria); MemoryStream memoryStream = new MemoryStream(); memoryStream = Manager.GenerateResxSourceCode(resourceFile); memoryStream.Position = 0; DownloadFile(memoryStream,resourceFile.Name); } catch (Exception ex) { // set exception message string errorMessage = String.Format("Failed to export resource fileid ={0}, error:{1}", fileId ,ex.Message); // trace call TraceUtil.Write("ResourceFilesService::ExportResourceFile", "Exception occured [{0}]", errorMessage); // publish and rethrow the exception BusinessException businessExc = new BusinessException(errorMessage, ex); throw (businessExc); } } private void DownloadFile(MemoryStream memoryStream,string fileName) { byte[] byteArray = memoryStream.ToArray(); memoryStream.Flush(); memoryStream.Close(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=test.resx"); HttpContext.Current.Response.AddHeader("Content-Length", byteArray.Length.ToString()); HttpContext.Current.Response.ContentType = "application/octet-stream"; HttpContext.Current.Response.BinaryWrite(byteArray); }DownloadFile method should force the Browser to open Save Dialog File, is there anything wrong with the code above, Could you please Help.
Regards,
Hanan