#1 Reuse Code and Razor Templates
The samples can differ based on your Razor base class or if you're running an old version.
Selected: Strong-Typed (2sxc 17.06+) Switch to Typed (2sxc 16+) Switch to Dynamic (Razor14 or below)
Selected: Strong-Typed (2sxc 17.06+) Switch to Typed (2sxc 16+) Switch to Dynamic (Razor14 or below)
Requirements
Reuse Code and Razor Templates
This will show you how to place partial templates into separate files, and how to put functions you need in many places in separate files as well. It focuses on:
When Using other Razor or Code, you should also know:
Model
is the typed object used in sub-pages to receive parameters from the caller - see docsMyModel
is the generic object used in sub-pages to receive parameters from the caller - see docs- To get a helper, just use
new Helper(...)
orGetService<HelperType>()
GetCode(...)
to create objects from .cs files sometimes still works, but is not recommended - see docs
#1 Reuse Code and Razor Templates