Code Templates – ASP.NET MVC development
May 16th, 2011
The 10.2 release of DevExpress IDE Tools (CodeRush Pro) has introduced a number of templates for MVC development. They include templates for C#, VB and ASPx (C# and VB) code. CodeRush text commands are marked as bold in template expansions, see the list of all text commands, to learn more.
CSharp templates:
Template |
Expansion |
act | public ActionResult «Caret»«Field(Action)» «BlockAnchor»() { return View(); } |
actp | [HttpPost] public ActionResult «Caret»«Field(Action)»«BlockAnchor»() { return View(); } |
cr | public class «Caret» «Field(MyController)» «BlockAnchor» : Controller { «FinalTarget» } |
Attributes |
|
[au | [Authorize] |
[he | [HandleError] |
[hp | [HttpPost] |
[rq | [Required] |
Namespaces |
|
umvc | using System.Web.Mvc; |
umvca | using System.Web.Mvc.Ajax; |
umvch | using System.Web.Mvc.Html; |
uswm | using System.Web.Mvc; |
uswma | using System.Web.Mvc.Ajax; |
uswmh | using System.Web.Mvc.Html; |
Inside ASPx code:
Template | Description |
al or hl | Creates an Html.ActionLink nugget. |
al, | Creates an Html.ActionLink nugget (without controller name). |
bf | Creates an Html.BeginForm nugget. |
bfa | Creates an Ajax.BeginForm nugget. |
bn | Creates an Html.Button nugget. |
brf | Creates an Html.BeginRouteForm nugget. |
cb | Creates an Html.CheckBox nugget. |
d | Creates an Html.DisplayFor nugget. |
ddl | Creates an Html.DropDownList nugget. |
e | Creates an Html.EditorFor nugget. |
fe | Creates a foreach loop nugget. |
h or hf | Creates an Html.Hidden nugget. |
if | Creates an if conditional nugget. |
ifl | Creates an if/else conditional nugget. |
rb (MVC1.0) | Creates an Html.RadioButton nugget. |
rb (MVC2.0+) | Creates an Html.RadioButtonFor nugget. |
rp | Creates an Html.RenderPartial nugget. |
tb | Creates an Html.TextBox nugget. |
vs | Creates an Html.ValidationSummary nugget. |
Show Visual Basic templates… »
Visual Basic templates:
Template |
Expansion |
act |
Public Function «Caret»«Field(Action)»«BlockAnchor»() As ActionResult Return View End Function |
actp |
Public Function «Caret» «Field(Action)» «BlockAnchor»() As ActionResult Return View End Function |
cr |
Public Class «Caret» «Field(MyController)» «BlockAnchor» Inherits Controller End Class |
Attributes |
|
<au | <Authorize()> |
<he | <HandleError()> |
<hp | <HttpPost()> |
Namespaces |
|
umvc | Imports System.Web.Mvc |
umvca | Imports System.Web.Mvc.Ajax |
umvch | Imports System.Web.Mvc.Html |
uswm | Imports System.Web.Mvc |
uswma | Imports System.Web.Mvc.Ajax |
uswmh | Imports System.Web.Mvc.Html |