Home > Code Generation > Code Templates – ASP.NET MVC development

Code Templates – ASP.NET MVC development

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

actpublic ActionResult «Caret»«Field(Action)» «BlockAnchor»()
{
return View();
}
actp[HttpPost]
public ActionResult «Caret»«Field(Action)»«BlockAnchor»()
{
return View();
}
crpublic class «Caret» «Field(MyController)» «BlockAnchor» : Controller
{
«FinalTarget»
}

Attributes

[au[Authorize]
[he[HandleError]
[hp[HttpPost]
[rq[Required]

Namespaces

umvcusing System.Web.Mvc;
umvcausing System.Web.Mvc.Ajax;
umvchusing System.Web.Mvc.Html;
uswmusing System.Web.Mvc;
uswmausing System.Web.Mvc.Ajax;
uswmhusing System.Web.Mvc.Html;

Inside ASPx code:

TemplateDescription
al or hlCreates an Html.ActionLink nugget.
al,Creates an Html.ActionLink nugget (without controller name).
bfCreates an Html.BeginForm nugget.
bfaCreates an Ajax.BeginForm nugget.
bnCreates an Html.Button nugget.
brfCreates an Html.BeginRouteForm nugget.
cbCreates an Html.CheckBox nugget.
dCreates an Html.DisplayFor nugget.
ddlCreates an Html.DropDownList nugget.
eCreates an Html.EditorFor nugget.
feCreates a foreach loop nugget.
h or hfCreates an Html.Hidden nugget.
ifCreates an if conditional nugget.
iflCreates an if/else conditional nugget.
rb (MVC1.0)Creates an Html.RadioButton nugget.
rb (MVC2.0+)Creates an Html.RadioButtonFor nugget.
rpCreates an Html.RenderPartial nugget.
tbCreates an Html.TextBox nugget.
vsCreates 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

umvcImports System.Web.Mvc
umvcaImports System.Web.Mvc.Ajax
umvchImports System.Web.Mvc.Html
uswmImports System.Web.Mvc
uswmaImports System.Web.Mvc.Ajax
uswmhImports System.Web.Mvc.Html
—–
Products: CodeRush Pro
Versions: 10.2 and up
VS IDEs: any
Updated: May/06/2011
ID: C098

Similar Posts:

  1. No comments yet. Be the first and leave a comment!
  1. No trackbacks yet.