We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

On post to SaveDefault IEnumerable is null

Thread ID:

Created:

Updated:

Platform:

Replies:

119920 Aug 13,2015 05:28 PM Aug 18,2015 01:38 AM ASP.NET MVC 3
loading
Tags: Uploadbox
Aubyn Crawford
Asked On August 13, 2015 05:28 PM

I'm using the UploadBox control and using the example code to implement the SaveDefault method, e.g.:

public ActionResult SaveDefault(IEnumerable<HttpPostedFileBase> UploadDefault)
        {
            foreach (var file in UploadDefault)
            {
         ...
        }
     ...
}

The problem is that UploadDefault is null... If I start from a blank project or run a sample project it works correctly. 
I first came across the problem in some older code - I added in SyncFusion to the project and on running the UploadDefault was null. I assumed it was just some code clash. or some hang over of the way I had implemented the MVC code.
I can actually see that the client code is returning (what appears to be) to the server an HTML response with the file encoded - so does not appear to be a client issue but server side processing

However, I started another new project and now that project is now returning null. I've checked all the things I can - has anyone else come across this? Have I missed something simple (e.g. jQuery version clash, incompatiblity with .NET 4.5.1)?

Thanks,


Prasanth Palani [Syncfusion]
Replied On August 14, 2015 09:32 AM

Hi Aubyn,
 Thanks for using Syncfusion products,
In MVC model binding, we specify the name of the component in the controller to get the values. Similarly here you need to specify the name of the uploadbox component in the controller. We maintain the “id” of the component as the “name”. So please specify the “id” of the component in the controller as shown below and you will get the file details in the IEnumerable object.

View


@Html.EJ().Uploadbox("FileUpload").SaveUrl(@Url.Action("SaveDefault")).RemoveUrl(@Url.Action("RemoveDefault"))



Controller


public ActionResult SaveDefault(IEnumerable<HttpPostedFileBase> FileUpload)

        {

            foreach (var file in FileUpload)



We have prepared simple sample to showcase your requirement, please check it,
http://www.syncfusion.com/downloads/support/directtrac/119920/UploadBoxsyn114344373.zip
If still you face any difficulties please revert back the provided sample based on your application to showcase the issue that you are facing and we will be happy to help you.
To know about the list of properties, methods and events supported by any JS component, go to the online help link for JS (http://helpjs.syncfusion.com/js/overview) and click on the “API reference” section and navigate to the particular component. For example, to know all the available options in DatePicker check the following link,
http://helpjs.syncfusion.com/js/api/ejdatepicker
For getting started and to know about the important features in any particular component, go to the help link and click on the particular component. For example, getting started and key features in DatePicker can be found in
http://helpjs.syncfusion.com/js/datepicker/overview

Please let us know if you have further queries.
 
Regards,
Gopal L

Aubyn Crawford
Replied On August 17, 2015 03:52 PM

I understand (now!) the relationship there, I knew there had to be a simple explanation - glad I posted. Thanks  

Gopal Lakshmanan [Syncfusion]
Replied On August 18, 2015 01:38 AM

Hi Aubyn,
           Thanks for the update, please let us know if need further asssitance.
 
 
Regards,
Gopal.L



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;