This is a migrated thread and some comments may be shown as answers.

How to pass extra parameter along with files parameter to server function by using Upload component ?

2 Answers 900 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
Daochuen asked on 05 Mar 2020, 09:26 PM
Hi,

I used Asynchronous Mode of the Upload component in my MVC project, how do I pass extra parameters along with [files] to server side method? My form have kendo dropdown list. I try to pass the selected value  to Save action in controller but failed to do so.  Could someone help?  Thanks.

Second parameter in below Save function should hold that value.


        public ActionResult Async_Save(IEnumerable<HttpPostedFileBase> files, string dropdownListValue)
        {
            // The Name of the Upload component is "files"
            if (files != null)
        …
        …
        }

2 Answers, 1 is accepted

Sort by
0
Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 05 Mar 2020, 09:53 PM

Found solution :Write code in Upload event.

function onUpload(e)

{

  e.data={dropdownListValue: 2}

}

0
Accepted
Martin
Telerik team
answered on 09 Mar 2020, 02:21 PM

Hello,

Thank you for sharing the solution. For future reference, I am sharing this How-To Article for further information.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Upload
Asked by
Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
Martin
Telerik team
Share this question
or