How to set css class of TextBox in Razor MVC

08 May 2014, 05:17 AM

You can pass the html attributes values in dictionary in key value pair.

@Html.TextBoxFor(m => m.UserName, new Dictionary() { { "class", "water" } }) 

In the above example “Class” is the name of attribute and “water” is the value.

Related Contents

15 May 2014, 08:07 AM
C#, LINQ, List
15 May 2014, 07:54 AM
C#, LINQ, List
29 Apr 2014, 03:07 AM
C#, Generic
29 Apr 2014, 02:51 AM
C#, Generic
About
explaing to set the css class of the text box using @Html.TextBoxFor() method in MVC

Date Posted 08 May 2014, 05:07 AM
Author Brainy Solutions
Views 1,513
;