Home How to conditionally add CSS class to Html.TextBoxFor
Reply: 0

How to conditionally add CSS class to Html.TextBoxFor

user4638
1#
user4638 Published in September 20, 2018, 8:45 pm

Can anyone help me how to add CSS class conditionally to Html.TextBoxFor in my razor view.

I am trying the following:

@Html.TextBoxFor(x => model.DateTimeStamp, new { @readonly = "readonly"}, ViewBag.IsNew ? (object)new {@class="test" }:null)
share|improve this question

1 Answer 1

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.315852 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO