Skip to content

Instantly share code, notes, and snippets.

@redwards510
Created February 20, 2018 23:52
Show Gist options
  • Save redwards510/61568f67ed0fe2636923d2466dcf92df to your computer and use it in GitHub Desktop.
Save redwards510/61568f67ed0fe2636923d2466dcf92df to your computer and use it in GitHub Desktop.
ASP.Net Razor Cheatsheet
tags
Cheatsheet
Razor

Razor Cheatsheet

Inside code blocks

@{
  // code blocks
}

statements like counter++ do not need any special markings or @ symbols in front of them. however you can do @(variable) to place a variable only on the page.

JSON parameter setting

This one can be tricky as it's a VS bug/issue

 data = {
     category: category,
     type: type,
     typeCode: typeCode,
     documentCounter: '@(documentCounter)'
 };

You must put the ' apostrophes around the var or VS will say it's an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment