ProgrammerGuide.Net | Step by Step Programmer Guide

How To Add CSS Class And Custom Property in Html.TextBoxFor? | ASP.NET MVC | RAZOR

For example, the below textbox can be illustrated using razor syntax

<input id="Name" name="Name" type="text" data-bind="value: Name" class="title width-7" />

Razor engine converts underscores in html attribute names into hyphens, so the below razor statement will help you to render the textbox with class

@Html.TextBoxFor(m => m.Name, new { data_bind="value: Name", @class = "title width-7" })
Please click here for related products on Amazon!


Add comment

Want to Check Celebrities News?