Skip to content
RobertTheGrey edited this page Jan 12, 2013 · 1 revision

<segment> (previously known as <section> before HTML5 was born)

Declares a segment of material passed in to a partial file reference.

Usage: anyXml1<partialFileName><segment name="anyName">anyXml3</segment></partialFileName>anyXml5

Given: anyXml2<render segment="anyName"/>anyXml4

Results in C#:

//anyXml1-generated-code
{
  //anyXml2-generated-code
  {
    //anyXml3-generated-code
  }
  //anyXml4-generated-code
}
//anyXml5-generated-code

When <render segment=""/> appears in a partial template it renders the contents of the <segment name=""> contained in the referencing <render partial=""> template. This enables partials to render several distinct micro-templates, for example a repeater partial could have top/bottom/even/odd named segments.

with *="" assignments

Usage: anyXml1<partialFileName><segment name="anyName" x="a" y="b">anyXml3</segment></partialFileName>anyXml5

Given: anyXml2<render segment="anyName"/>anyXml4

Results in C#:

//anyXml1-generated-code
{
  //anyXml2-generated-code
  {
    var x = a;
    var y = b;
    //anyXml3-generated-code
  }
  //anyXml4-generated-code
}
//anyXml5-generated-code
Clone this wiki locally