Uploaded file not passes to Action (controller)

3 posts, 0 answers
  1. Silver Lightning
    Silver Lightning avatar
    44 posts
    Member since:
    Feb 2014

    Posted 02 Jun 2014 Link to this post

    Hi Sir

    I used async upload, on my view I used the event select and upload function. the problem is the request not sent to the Action once I uploaded a file.

    Here's my code snippet.

     $(document).ready(function () {

    var lookup = $("#ComboLookupTable").data("kendoComboBox");
    $("#get").click(function () {

    async: {
    saveUrl: "UploadFile/Lookup",
    removeUrl: "remove",
    autoUpload: false,
    value: 'Import'
    multiple: false,
    progress: function (e) {

    upload: function (e) {
    // debugger;
    var kendoWindow = $("<div />").kendoWindow({
    title: "Replace Lookup Table Data?",
    resizable: false,
    modal: true


    .click(function () {
    if ($(this).hasClass("delete-cancel")) {

    // kendoWindow.data("kendoWindow").close();
    else {
    e.data = { additional: $("#ComboLookupTable").val() };


    // ---------

    //e.data = { additional: $("#ComboLookupTable").val() };
    select: function (e) {
    // debugger;
    e.data = { additional: $("#ComboLookupTable").val() };
    localization: {
    select: "Select a file",
    uploadSelectedFiles: "Import",
    remove: "Remove"
    //upload: onUpload
    //select: onSelect


    Here's my controller (action)

    'Upload File (excel)
    <HttpPost> _
    Public Function UploadFile(ByVal files As HttpPostedFileBase, ByVal additional As String) As ActionResult

    Dim data = (New ExcelReader()).ReadExcel(files)

    Select Case additional
    Case FuelEfficiencyViewModel.Table.Lookup.ConversionFactors
    Return View()
    Case FuelEfficiencyViewModel.Table.Lookup.ElectricalRegionalEmissionFactors
    Return View()
    Case FuelEfficiencyViewModel.Table.Lookup.ElectricalSubRegionEmissionFactors
    Return View()
    Case FuelEfficiencyViewModel.Table.Lookup.FuelEfficiecies
    Dim ent As New List(Of ViewModel.FuelEfficiencyViewModel.Create)

    For Each datarow In data.DataRows
    ent.Add(New ViewModel.FuelEfficiencyViewModel.Create With {.VehicleClass = datarow(0).ToString, _
    .FuelEfficiencyValue = Convert.ToDecimal(datarow(1)), _
    .CreatedBy = Session(LocalConstant.Ses_UserID), _
    .CreatedDate = Now.Date})
    Return View()
    Case FuelEfficiencyViewModel.Table.Lookup.GlobalEmissionFactors
    Return View()
    Case FuelEfficiencyViewModel.Table.Lookup.GlobalWarmingPotential
    Return View()

    End Select

    'Session(LocalConstant.SessionExcelData) = resultList

    Return View("Index", data.Status)
    'Return View()
    End Function

    Thank you in advance and God bless.
  2. Silver Lightning
    Silver Lightning avatar
    44 posts
    Member since:
    Feb 2014

    Posted 03 Jun 2014 in reply to Silver Lightning Link to this post

    I solved it. Thanks
  3. Dimiter Madjarov
    Dimiter Madjarov avatar
    2213 posts

    Posted 03 Jun 2014 Link to this post

    Hello Jesureno,

    Nice to hear the problem is solved. Let us know if you experience any further issues.

    Have a great day!

    Dimiter Madjarov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top