Here is my situation:
I dynamically generate RadGrid from code behind (number of RadGrid, and their ID, is unknown before the page load, it depends of a database).
I have a unique PlaceHolder "Grids" (to insert my RadGrids), RadAjaxManager and RadAjaxLoadingPanel.
I create their ItemCommand and ajaxify each RadGrid basically as follow:
Now I'm trying to add a RadAsyncUpload. The purpose is that the user upload a file, which will be read server-side, insert some data in the database, and will rebind the grid displaying the newly added rows. Each grid can have its own upload button, therefore I think placing it in the GridCommandItemTemplate makes sense and is user friendly. I've added the RadAsyncUpload and so far so good.
However. When my postback is triggered, it's not ajaxified. My whole page is reload. I was expecting my RadAsyncUpload to behave like the other RadButtons of the GridCommandItemTemplate but it's not.
I have tried to ajaxify it during the Item_created event of my RadGrid but I get an error about the collection being modified.
Does someone have a solution ?
4 Answers, 1 is accepted
Can you confirm you are adding the AJAX settings in the Page_Load event, because adding them In Page_Init is too early: http://docs.telerik.com/devtools/aspnet-ajax/controls/ajaxmanager/how-to/add-ajaxsettings-programmatically?
If this does not help, can you post here a small snippet that shows the problem - a single grid with its command item template should suffice?
Yes I add the ajax settings in the Page_Load event.
I made a sample of my issue with 3 files, I think you can easily reproduce it.
I hope this will help you. Thank you for your help.
Generally, another control POSTs the page after the files are uploaded. You could easily do that via one of the other buttons in the header template. A simple DOM traversal + the name attribute of the input element will give you a valid __doPostBack() call. This button could be hidden if it will not be used for other purposes.
An alternative is to use the full name of the async upload, because this is how MS AJAX traps requests:
This approach worked for me (I am adding a small sample here) and if you do not wish to use other buttons, this should work.
Using source.get_id() worked. It ajaxified my command. However my controls were not updated (not sure for the grid, but at least the RadLabel I'm using to show what happens server side was definitely not updated).
However your idea of the hidden button made me realize I just have to fire any command of my RadGrid after the upload.
Now it's working just as I wanted :)
Thank you !