Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Amri 214 posts 740 karma points
    Nov 19, 2018 @ 09:10
    David Amri
    0

    No route in the route table matches the supplied values

    Hi,

    I'm trying to render a partial view within a template. But I keep getting a "No route in the route table matches the supplied values."?

    Surface controller (FileDonwloadSurfaceController):

    using Umbraco.Web.Mvc;
    using System.Web.Mvc;
    
    namespace PyramidWebsite.Controllers
    {
        public class FileDownloadSurfaceController : SurfaceController
        {
    
            public const string PARTIAL_VIEW_FOLDER = "~/Views/Partials/FileDownload/";
    
            public ActionResult RenderFileDonwload()
            {
                return PartialView(PARTIAL_VIEW_FOLDER + "_FileDownload.cshtml");
            }
        }
    }
    

    Model (FileInfo):

    namespace PyramidWebsite.Models
    {
        public class FileInfo
        {
            public int FileId { get; set; }
            public  string FileName { get; set; }
            public string FilePath { get; set; }
        }
    }
    

    Model (FileDownload):

    using System.Collections.Generic;
    using System.IO;
    
    namespace PyramidWebsite.Models
    {
        public class FileDonwloads
        {
            public List<FileInfo> GetFile()
            {
                List<FileInfo> listFiles = new List<FileInfo>();
                string fileSavePath = System.Web.Hosting.HostingEnvironment.MapPath("~/Media");
                DirectoryInfo dirInfo = new DirectoryInfo(fileSavePath);
                int i = 0;
    
                foreach (var item in dirInfo.GetFiles())
                {
                    listFiles.Add(new FileInfo()
                    {
                        FileId = i + 1,
                        FileName = item.Name,
                        FilePath = dirInfo.FullName + @"\" + item.Name
                    });
    
                    i = i + 1;
                }
    
                return listFiles;
            }
        }
    }
    

    The partial view:

    @inherits UmbracoViewPage<PyramidWebsite.Models.FileInfo>
    
    @Html.ActionLink("Donwload Files", "Download")
    

    Inside the template I'm doing:

    @{Html.RenderAction("RenderFileDonwload", "FileDonwloadSurface");}
    

    Best regards /David

  • Julien Kulker 75 posts 427 karma points c-trib
    Nov 19, 2018 @ 10:01
    Julien Kulker
    100

    I am not sure if that is your problem but you have a big typo in your code:

    FileDonwloadSurface = FileDownloadSurface

  • David Amri 214 posts 740 karma points
    Nov 19, 2018 @ 10:03
    David Amri
    0

    OMG

Please Sign in or register to post replies

Write your reply to:

Draft