In this article I will explain with an example, how to pass (send) String Array from Controller to View in ASP.Net MVC Razor.
The String Array will be passed (sent) from Controller to View as Model in ASP.Net MVC Razor.
 
 
Controller
The Controller consists of the following Action method.
Inside the Index Action method, the String Array is created and is sent to the View as Model.
public class HomeController : Controller
{
    // GET: Home
    public ActionResult Index()
    {
        string[] customers = new string[4];
        customers[0] = "John Hammond";
        customers[1] = "Mudassar Khan";
        customers[2] = "Suzzane Mathews";
        customers[3] = "Robert Schidner";
 
        return View(customers);
    }
}
 
 
View
Inside the View, in the very first line, the String Array is specified as Model.
For displaying the records, an HTML Table is used. A loop will be executed over the Model which will generate the HTML Table rows with the items of the String Array.
@model string[]
@{
    Layout = null;
}
 
<!DOCTYPE html>
 
<html>
<head>
    <meta name="viewport" content="width=device-width"/>
    <title>Index</title>
</head>
<body>
    <table border="0">
        <tr><th>Name</th></tr>
        @foreach (string customer in Model)
        {
            <tr><td>@customer</td></tr>
        }
    </table>
</body>
</html>
 
 
Screenshot
Pass (Send) String Array from Controller to View in ASP.Net MVC
 
 
Downloads