I am learning ASP.NET MVC with Razor.
I noticed that sometimes some cshtml files already have some namespaces imported (example for NopCommerce, which I am using to learn)
@model ProductListModel
@using Telerik.Web.Mvc.UI
Or
@{
Layout = "~/Views/Shared/_ColumnsOne.cshtml";
Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.fileupload.js"));
Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.lightbox-0.5.min.js"));
Html.AppendCssFileParts(@Url.Content("~/Content/Style/jquery.fileupload-ui.css"));
Html.AppendCssFileParts(@Url.Content("~/Content/Style/jquery.lightbox-0.5.css"));
}
(Html.AppendScriptsParts is declared in the nop.Web.Framework.UI)
If I make my own cshtml file, I need to add the “using” line or reference with the like this:
@using System.Linq;
@using Nop.Web.Framework.UI
@model Nop.Admin.Models.Proposal.ProposalListModel
Is there any trick I am missing to reference these items? Why are the first 2 examples simpler and do not need the explicit reference?
Thanks!
Add your namespace here
...\Views\Web.config: