How to make Rotativa wait for javascript/jquery execution - rotativa

I have a View that renders and some javascript/jquery that updates some fields. When I use Rotativa, it renders the view, but before the JS is executed to replace some field text.
Is there a way to delay Rotativa or have it wait for JS/JQuery?

You should be able to delay pdf creation to wait for javascript to complete by setting this in Rotativa params:
CustomSwitches = "--no-stop-slow-scripts --javascript-delay 1000 "
Replace 1000 with the desired milliseconds.

I was facing same issue, and after so much googling and experiment my problem resolved by updating Rotativa to latest stable version as 1.6.4 using Manage Nuget Packages.
May be it will help someone.
Thanks.

I had the same issue, we have a site using both ASP MVC for back-end and AngularJS for the front and couldn't get it it work, so created custom razor views for exporting. Was justifiable for this project to meet future client needs. but in other projects might have to look elsewhere for exporting.

Related

How to merge 150+ Get Request for ScriptResource.axd into 1 without CombineScript

I am using AjaxControlToolKit which results in 150+ Get requests for ScriptResource.axd even when there are 2 controls on the page. My requirement is to minimize this number of requests. I have tried CombineScript = "true" and reduces the number of requests but it is not compatible with the Telerik DLL, hence Telerik gives a JavaScript error and as my application relies heavily on Telerik, I can't choose that option.
Can anyone help me in combining these requests manually without using the CombineScript property of AjaxToolKit Script Manager.
Telerik has its own ScriptManager called RadScriptManager - you can use that to combine your scripts and it will work fine with the telerik controls.
More details in the documentation.

Symfony Sonata AJAX image multi-upload

I am trying to create a portfolio site and am stuck finding a good approach to deal with images. I have integrated the SonataAdmin Bundle and have setup Admin classes for "Projects" and "Images". My goal is to go into a Project and add images to it and select one of these images as the Project thumbnail.
Ideally I would like to integrate an AJAX multi-uploader. I am not sure the best approach for this and am looking for any suggestions / thoughts.
I have looked at the Sonata Media Bundle, though it seems more robust than I actually need and the learning curve to customize it seems a bit steep. I have already setup an image entity (symfony2 cookbook for uploading documents) I imagine I can create a many-to-one on images and projects rather than using the MediaBundle, though I am still at a loss of how to integrate an AJAX script for this.
Thanks in advance for any advice!
Shawn
I suggest you to look at https://github.com/punkave/symfony2-file-uploader-bundle
This bundle is based on the excellent blueimp jQuery-File-Upload package and provides multiple file uploads.
Edit 28/04/14: There is now also OneupUploaderBundle which supports a variety of uploaders and seems to be under more active development.
checkout https://github.com/ruian/RuianUploadifyBundle its support multiupload but only with flash plugin.
Also this bundle is worth a shot. Not really mentioning AJAX, but seems really strong in basic uploading features. Once you get that done, you can ajaxify by yourself. I'm planning to try this bundle in few days, I may update this answer later.
So I endedup using Valumns Ajax multi uploader: http://valums.com/ajax-upload/
I tried to customize the Sonata Admin Page but this proved a bit difficult, Instead I simply created a route / controller / view specifically for uploading batch images. It seems to be working great!

ASP.Net MVC 3 big file uploader with progress

I've spent several hours of googling. Can anybody point me to an example of big file uploader with progress with backend on ASP.Net MVC3. I found many different solutions, but most of them use PHP as backend, and it's a bit hard for me to convert. Also I think there have to be some examples for ASP.Net MVC3.
PS I don't consider paid components, please don't suggest them.
Uploadify - there you have it :)
Set maxRequestLength in the web.config
http://midnightprogrammer.net/post/Upload-Files-In-RAZOR-With-jQuery-Uploadify-Plugin.aspx
You could try out Telerik Upload not sure what the file size limit is though.
This is a free and opensource component from Telerik.
I spent a good amount of time getting the right plugin too.
I use this :
http://valums.com/ajax-upload/
Uploadify uses flash to send files, which was bad for me as i needed upload from authenticated users ONLY. And flash would not send the cookies and so your application will treat the upload request as anonymous. If that is not an issue, uploadify works fine too.
Here is how i implemented it in mvc3 -
Create a controller / action to receive the opload file.
Change the 'action' property of the plugin to point to it -
// url of the server-side upload script, should be on the same domain
action: '/controller/action'
Make sure that action returns JSON object with a property in it with 'success' = 'true'/'false'

how to integrate ajax to my project

What do i need to do for putting ajax functionality to my project.
What tool kit do i need to download or how can i integrate that .
and do i really need to do something for putting update panel for my project?
One method for AJAX enabling your ASP sites is using the AJAX control toolkit (http://www.asp.net/ajax/ajaxcontroltoolkit/samples/) which provides some AJAX functionality using ASP controls that should be familiar to a novice Dot Net developer. AJAX Control Toolkit is a DLL you add to your solution just like other controls. There is then markup for use in the ASP.NET pages.
For more customized and advanced AJAX features, your best bet is using JQuery (http://jquery.com/) and create *.asmx Web Services. JQuery includes a $.ajax() call that will communicate to ASP.NET Web Services using JSON. This SO page may help - Calling ASMX from jQuery and this Encosia blog entry may help - http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/. JQuery is a library of JavaScript files that you download, include in your page, and call into using your own JavaScript files.
I would also recommend that you read the wikipedia entry for AJAX (http://en.wikipedia.org/wiki/Ajax_(programming)) and familiarize yourself with the related technologies.
I think you need to provide a lot more information before we can give youa definitive answer.
Ajax is simply using Javascript to request a webpage - same as a user clicking on a link - except that JavaScript gets the contents of the page requested instead of showing it to the user.
This allows you to request data within JavaScript without refreshing the page.
As you mentioned UpdatePanel, I'm assuming you're using ASP.Net - In which case, .Net 2.0 didn't include AJAX and you needed to get some additional installs to make it work. 3.5 and later includes it natively.
If you're just starting to get into the whole area, I suggest you do some reading about how AJAX works behind the scenes before trying to use it - Understanding what its doing will save you a LOT of headaches later.
FWIW you don't actually need ANYTHING special to make AJAX work - you can write it yourself entirely in JavaScript (I've done this far too many times). As mentioned in Doug's answer, JQuery is fantastic and is worth using even without the AJAX functionality.
If, however, you want to use UpdatePanels and AJAX, the easiest option is .Net 3.5 or later (Visual Studio 2008 or later)
In my opinion, jQuery has the best AJAX functionality and is easy to learn and use. It's got great documentation and there are lots of tutorials and examples -- I love it.

Upload an image using jquery AJAX in .net MVC

I am creating one application in .net MVC, in which I am using jQuery AJAX to post some data to server. The data posting is working fine, but I also need to upload one image along with the data. I have searched on stack over flow for similar question but they are not able to help me. I donot want to use flash to upload file, pure jquery solution will help me.
Using some solution I tried to post to server, but on server side I am not getting file data.
Please can some body tell me how to implement file upload in jQuery ajax?
Thanks
Ashwani
I think you're out of luck if you want ajax like uploading without flash. Due to security limitations javascript can't do all the things required. Off the top of my head i'd say your only other option will be to use an iframe to make it appear as thought it was an ajax post.
Why not use flash though? YUI Uploader is amazingly simple and works great!

Resources