Using Directives in Asp.Net MVC pages

812 views Asked by At

I would like to use a use an alias in my views to make the code more expressive, so I have tried permutations of the following

namespace RES.Project.MVC.ViewModels
{
    using ECMAlertListUrl = System.String;
}

and in the view

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<RES.Project.MVC.ViewModels.ECMAlertListUrl>" %>

I have done some experimentation / reading, and I think this isn't possible as the using directive is scoped to the containing namespace or compilation unit (eg .cs file), but if anybody can probe me wrong or has any other suggestions then I'm all ears.

0

There are 0 answers