default
view on [ViewFolderRoot]/components/[componentname]
. You can also override ViewComponent.SupportsSection if your component supports neste sections (ie templates provided on the view that uses the view component.
Another way is to use the ViewComponentDetailsAttribute to specify a custom name and the sections supported.
Notice that view components can render strings or views on their folder. You can create sophisticate components with that mixture. Sections allow the users of your component to give it a block of content, usually customizing or definiting the content to be especially rendered by your component.
public class ShowTime : ViewComponent { public override void Initialize() { } public override void Render() { RenderText("Time: " + DateTime.Now.ToString()); } }
This can be used from the view using the following syntax (NVelocity view engine)
#component(ShowTime)