Skip to content

solution • C# in Visual Studio

Martin Dubé edited this page Dec 2, 2020 · 12 revisions

Comments

@* Inline commented text *@

@*
    Block of commented text
*@

Conditionnal logics

One line shorthands

"#= Value ? 'True_String' : 'False_String' #"

@(ViewBag.Value ? "True_String" : "False_String")

Add shorthands as variables within your .cshtml templates to clean-up the code for easier maintenance.

@{ 
    var templateBrand = "#= Brand ? 'Brand' : '' #";
    var templateModel = "#= Model ? 'Model ' : '' #";
}

Ressources

Add .ToLower function to your ressource string to print it in lowercase.

@Resources.Template.ResourceManager.GetString(String.ToLower())

 

Kendo

Kendo UI

Kendo Grid

.Title() content will be populating the <thead><tr><th>table column heading</th></tr></thead> while the .ClientTemplate() wraps it's value within the <tbody><tr><td>table column cell</td><tr></tbody>.

c.Template(p => {} )
    .Title( Resources.Template.HeadingString1 + " " + Resources.Template.HeadingString2 )
    .ClientTemplate( "td" )
    .HtmlAttributes(new { @class = "my-css-class" });
Clone this wiki locally