MVC Razor RC 1: Can @section be defined with a string constant?

Is there a way to use a line on a page using the layout of the wizard and invoking the section?

So instead:

@section SomeSection 

Could i do this?

  @section "SomeString" 

Or better

  @section SomeClass.SomeConstantString 

The reason of that? So that I can use the constant line on the main page for the section name and use the same constant on the partial page.

  @RenderSection(eClass.SomeConstantString, required:false) 

I really hope there is a way to do this, otherwise it seems like a problem in general.

+6
asp.net-mvc razor
source share
1 answer

No, It is Immpossible. I don’t see this as such a big restriction, because if the layout renders the required section and the names do not match, you will get a runtime error.

+5
source share

All Articles