I am working on a project in ASP.NET MVC 5, I have a TABLE in my VIEW, where I am showing the content of an ftp folder via list and Viewbag.
I need the Table to be clickable. I used *.js file so the rows are clickable, but now I have a problem with getting the name of the file (value of a row) back to Controller.
View code :
<table class="row col-md-12 leva table-responsive table-bordered table-hover ">
<tbody data-link="row" class="rowlink">
@foreach (var item in ViewBag.files)
{
<tr>
<td class=" row col-md-12 "><a href="#" target="_blank"> <h5> @item</h5></a></td>
</tr>
}
</tbody>
</table>
And Controller code:
List<string> ftpfiles = new List<string>();
try
{
var ftpco = new Project.Helpers.ftp(@path, name, passwd);
string[] simpleDirectoryListing = ftpco.directoryListSimple("");
for (int i = 0; i < simpleDirectoryListing.Count(); i++)
{
if (simpleDirectoryListing[i].Length >= 3)
{
ftpfiles.Add(simpleDirectoryListing[i]);
}
}
ViewBag.files = soubory;
}
catch { ViewBag.files = "nenacteno"; }