This is a migrated thread and some comments may be shown as answers.
Upload in Grid Popup
3 Answers 51 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
rrawla
Top achievements
Rank 1
rrawla asked on 04 Nov 2011, 01:49 AM
Hi,
We are using a MVC3 Razor with Telerik MVC Grid extentions , my problem is that I'm trying to upload a file using regular file upload control using Grid in POPUP mode , but I'm not getting the file information back in controller method.I'm able to succesfully use the MVC upload control however  My client does not want to use MVC upload control due to the look and feel. I've 2 options 

1. Change look and feel of Telerik MVC control to normal upload (hope this is possible)
2. Make the regular upload work in grid popup with ajax binding approach

I've tried all the samples and possible solns mentioned this forums including jQuery Ajax form,

PS: if I've the server binding with Grid popup mode this works but has many other issues.in fact there is a bug I woild like to report that
for example , you open popup in insert mode and enter information and then press insert and then after the popup closes, if you press back buton the popup shows up again.However if you close the popup with "x" button and press back button the popup does not show.

Any help is highly appreciated
 

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 04 Nov 2011, 01:38 PM
Hi Rrawla,

I'm afraid that files cannot be send through XMLHttpRequest therefore using input type=file with grid's ajax binding is not possible, thus server binding should be used. 
Regarding the issue you have described with the close icon of the popUp edit form in server binding, this should be already resolved, please download the latest internal build and give it a try.

Regards,
Rosen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
rrawla
Top achievements
Rank 1
answered on 04 Nov 2011, 02:35 PM
Hi Rosen,
Thanks for the response,appreciate that.I wish I could use the MVC Upload control but my user is used to using the standard upload.
hopefully in the future versions we will have a default vs skinned control.

You'll be glad to know that I found a workaround for this , first I followed the approach suggested by Manuel in this thread
http://www.telerik.com/community/forums/aspnet-mvc/general/grid-file-upload.aspx

then Instead of using jQuery.Form I used jQuery.Upload from this link
http://lagoscript.org/jquery/upload/documentation?locale=en

so my code looks something like
function onEdit(e) {
       var _mode = e.mode;
       var _form = e.form;
             if (_mode == 'insert') {
           $(_form).submit(function () {
               $(this).upload('/Attachment/SaveFile');
           });
           return false;
       };
       
   }

and I included the script in my _layout.cshtml like this
@(Html.Telerik().ScriptRegistrar()
.Scripts(scripts => scripts.Add("~/Scripts/jquery.upload.js"))
.DefaultGroup(group => group.Combined(true)
.Compress(true)))

also you need to make sure that  in your controller you do not have [HttpPost] on the SaveFile action otherwise it won't work.
you'll also notice that the savefile is called asynch. ,

Many thanks.

0
Mei Zaochun
Top achievements
Rank 1
answered on 25 Nov 2011, 09:11 AM
If I want to using file upload in Grid popup, what can I do? Thanks.
Tags
General Discussions
Asked by
rrawla
Top achievements
Rank 1
Answers by
Rosen
Telerik team
rrawla
Top achievements
Rank 1
Mei Zaochun
Top achievements
Rank 1
Share this question
or