Multiple ITemplate placeholders equivalent in ASP.Net MVC

The Boss

New Member
I am new to ASP.Net MVC and have always been using Web Forms till now. I have found Replacement for ITemplate in MVC? which gives an example of creating an HTML helper named BeginBlock which wraps the title & content from:\[code\]@using (Html.BeginBlock("MY TITLE")) { MY CONTENT GOES HERE}\[/code\]to\[code\]<div> <div><h1>MY TITLE</h1></div></div>MY CONTENT GOES HERE\[/code\]I have a scenario where in Web Forms, we used to use multiple ITemplates to define containers within user controls which we then wrapped inside HTML, for example, in Web Forms, we could create a user control named Panel and have two ITemplate properties, one named Content and the other named ContentNonScrollable. We would then use the user control by using the following markup:\[code\]<MySite:Panel> <Content> Content 1 Goes Here </Content> <ContentNonScrollable> Content 2 goes here </ContentNonScrollable></MySite:Panel>\[/code\]The user control would then output the following, HTML:\[code\]<div class="my-panel"> <div class="my-panel-content"> Content 1 Goes Here </div> <div class="my-scrollable-panel-content"> Content 2 Goes Here </div></div>\[/code\]Is there any way in MVC, where through HTML Helpers (or anything else), we can devise something equivalent to the above Web Forms example through markup within the .cshtml template file?For example something like (obviously, the below doesn't have correct syntax, just to explain what we have in mind):\[code\]@using (Html.BeginPanel() { { Content 1 Goes Here } { Content 2 Goes Here }}\[/code\]
 
Back
Top