tags:

views:

29

answers:

2

Dear SO surfers,

<ul>
    <li><% Html.ActionLink(StringHelper.TryGetLocalString("Something"),
         "Blah", "Blah"); %></li>
</ul>

I had tp make the StringHelper class above public before I could see it from within my partial view.

Why??

(side note: resolving to local string will be done in my controller not in the view (layout) but its a good quick example).

Thanks for you help, Luke

+1  A: 

Since the StringHelper is most likely not compiled into the same DLL as the rest of the code for the MVC site, it doesn't have access to internal things.

This will be the case when you have controllers, views, etc, as the default MVC website setup (and how it works when debugging) is to compile the regular code down to a DLL, then compile the pages/views separately. This also happens when you have "Updatability" setup when you publish the website.

Rangoric
+1  A: 

Views (or aspx/ascx files) in ASP.NET are compiled when the web server loads the application. This probably means that they are in another assembly and your classes are internal... you get the point.

Stilgar