How do I import a namespace in Razor View Page?

By 27th November 2018ASP.NET

How can i import namespaces in razor page in asp.net mvc

For namespace and Library

@using NameSpace_Name

For Model

 

@model Application_Name.Models.Model_Name 

For Iterate the list on Razor Page (You Have to use foreach loop for access the list items)

 

@model List<Application_Name.Models.Model_Name>

@foreach (var item in Model)
   {  
          <tr>
                <td>@item.srno</td>
                <td>@item.name</td>
         </tr>  
   }

Leave a Reply