Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Import Excel file. After that i wont to redirect to view another view with import data.

Am using one view to import data(Capture View) But i need to display this data Another View (Create view)

What I have tried:

IFormFile file = Request.Form.Files[0];

           string folderName = "UploadExcel";
           string webRootPath = _hostingEnvironment.WebRootPath;
           string newPath = Path.Combine(webRootPath, folderName);
           StringBuilder sb = new StringBuilder();
           if (!Directory.Exists(newPath))
           {
               //Directory.CreateDirectory(newPath);
           }
           if (file.Length > 0)
           {
               using var ms = new MemoryStream();
               file.CopyTo(ms);

               var Orderz = GetExcelContent(ms);

               model.Neworder = Orderz;
           }



           return View("Create", model);
Posted
Updated 14-Dec-20 1:21am
v3

1 solution

To redirect the user to another action once the import has finished, return RedirectToAction:
ControllerBase.RedirectToAction Method (Microsoft.AspNetCore.Mvc) | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900