Skip to content
Loading
C# MVC Visual Studio 2015 

 Note: In the above code you have to bind your data to the table dyanamically.
0
  • Thank you for the replies. I think the answers are concerned with only one .txt file.

    Vincent's reply is close but I do not want to browse the .txt file to be shown on my client page.
     
     I am in a process where the user clicks the links of the path in a table column "tablefile"

    which contains different .txt files in each row. So when the user clicks on one link he should get the data contained in that text file.When he clicks the next link he should contain data in that .txt file and so on...

    All the .txt files are in same folder with different names. 
     
     
    So how can I accomplish this? 
    -1
  • Amit Mohanty
    Controller:
    1. public class HomeController : Controller  
    2. {  
    3.     // GET: /Home/  
    4.     public ActionResult Index()  
    5.     {  
    6.         string text = System.IO.File.ReadAllText("E:\\AMIT\\Study\\Code.txt");  
    7.         TempData["Code"] = text;  
    8.         return View();  
    9.     }  

     View:
    1.   
    2.     

      @TempData["Code"]

        
     
  • 0
  • Vincent Maverick Durano
    Start here to get started: https://www.aspsnippets.com/Articles/Upload-Read-and-Display-CSV-file-Text-File-data-in-ASPNet-MVC.aspx
    +1