JetBrains Rider 2023.2 Help

Predefined Live Templates for ASP.NET

This topic lists all predefined live templates for ASP.NET in JetBrains Rider 2023.2. For more information about live templates, refer to Create source code using live templates.

Template

Details

ctx

Current file context

Scope Everywhere

Body

$CTX$

Parameters

  • CTX - Provides a list of items describing current context. This includes file name, containing type name, namespace name, etc.

nguid

Insert new GUID

Scope Everywhere

Body

$GUID$

Parameters

  • GUID - Generates a new Globally Unique Identifier (GUID)

<script

Create script tag

Scope HTML and similar tags

Body

<script type="$attributeValue$">$END$</script>

Parameters

  • attributeValue - Suggests an attribute value for the current HTML tag attribute

  • END - The caret position after the template is applied.

t

Create ASP.NET tag

Scope ASP.NET tags

Body

<$TAG$ $RUNATSERVER$>$END$</$TAG$>

Parameters

  • TAG - Suggests a tag name used in the current document

  • RUNATSERVER - Inserts runat="server" if a server-side tag selected

  • END - The caret position after the template is applied.

Before expansion

JetBrains Rider: Live templates
After expansion
JetBrains Rider: Live templates

tc

Create closed tag

Scope ASP.NET tags

Body

<$TAG$ $RUNATSERVER$$END$/>

Parameters

  • TAG - Suggests a tag name used in the current document

  • RUNATSERVER - Inserts runat="server" if a server-side tag selected

  • END - The caret position after the template is applied.

Before expansion

JetBrains Rider: Live templates
After expansion
JetBrains Rider: Live templates

a

Create tag attribute

Scope HTML and similar attributes

Body

$ATTR$="$END$"

Parameters

  • ATTR - Suggests an attribute name used in the same tags in the current document

  • END - The caret position after the template is applied.

ASP.NET Hyperlink

Scope ASP.NET tags

Body

<asp:HyperLink runat="server" NavigateUrl="$LINK$" Text="$TEXT$" />

Parameters

  • LINK - no macro

  • TEXT - no macro

foreach

foreach block

Scope ASP.NET tags

Body

<% foreach ($TYPE$ $VARIABLE$ in $COLLECTION$) { %> $SELECTION$ $END$<%}%>

Parameters

  • COLLECTION - Suggests a visible variable that can be enumerated (that is, used in a foreach loop as collection)

  • TYPE - Suggests a type for a new variable declared in the template

  • VARIABLE - When executed in a variable declaration (where variable name should stand), suggests a name for the variable

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

Last modified: 04 September 2023