Nesting View Components in AspView

on November 11th, 2007 at 2:37pm , , 0 responses

Following a request from Gauthier Segay, AspView now supports nested view components.


scenarion: you are using CaptureFor to inject markup from a view to a layout, and you want the injected markup to include a view component output.


in the layout:

<%=CapturedContent %>


in the view:

<component:CaptureFor id="CapturedContent">
   Some markup
   <component:SomeFancyStuff>Fancy component content</component:SomeFancyStuff>


While working on that, I found out yet another problem. nested components of same type would brake



would brake.

As you probably might know, the whole preprocessing of view, from AspView syntax to standard C# is done with Regular Expressions. For quickly doing the above, I helped myself to in order to build the balanced tags aware regular expression, and now it works like a charm. Roy Osherove's Regulator was helpful, too.


So, as of revision 360 in Castle Contrib repository, nesting view components works (for both the trunk and the RC3 compatible branch)


As usual - go to to get the binaries, or to for the sources.



Comment preview:



Posts count: