ejaz mirza

ejaz mirza

  • NA
  • 471
  • 47.2k

System.Collections.Generic.List`1[System.String]

Apr 2 2018 6:41 AM
am getting the output but it displays the line that
 System.Collections.Generic.List`1[System.String]
  1. List<ListItem> files = new List<ListItem>();  
  2.            List<String> fi = new List<String>();  
  3.            string dpath = Path.GetDirectoryName(Server.MapPath("~/Files/"));  
  4.                while (sd.Read())  
  5.                {  
  6.                    if (sd["attachmentname"] != DBNull.Value)  
  7.                    {  
  8.                        ss = "\\" + sd["attachmentname"].ToString();  
  9.                        s1 = dpath + ss;  
  10.                    }  
  11.                foreach (string filePath in filePaths)  
  12.                {  
  13.                    if (filePath.Equals(s1))  
  14.                    {  
  15.                        files.Add(new ListItem(Path.GetFileName(filePath), filePath));  
  16.                        //   files.Add(Path.GetFileName(filePath));  
  17.                        fi.Add(Path.GetFileName(filePath));  
  18.                    }  
  19.                }  
  20.                }  
  21.                sd.Close();  
  22.                con.Close();  
  23.                cd1.Dispose();  
  24.        //    List<String> ls=files.ToList<String>;             
  25.                return PartialView("gridattch",fi);         
  1. @Model List<string>  
  2.     @{  
  3.         Layout = null;  
  4.         //<IEnumerable>  
  5.     }  
  6.     <html>  
  7.     <head>  
  8.   
  9.     </head>  
  10.     <body>  
  11.   
  12.         <div id="div1">  
  13.             <table>  
  14.                 <tr>  
  15.                     <th>File Name</th>  
  16.                     <th>Link</th>  
  17.                 </tr>  
  18.                 @for (var i = 0; i <= Model.Count - 1; i++)  
  19.                 {  
  20.                     <tr>  
  21.                         <td>  
  22.                             @Model[i].ToString()  
  23.                         </td>  
  24.                         <td>  
  25.                             @Html.ActionLink("Download", "Download", new { selectedfilename = @Model[i].ToString() })  
the output am getting but i want to remove the error(System.Collections.Generic.List`1[System.String]) on the page just see the picture 

Answers (4)