1

I'm working in ASP.NET MVC 1.0 using MvcContrib FluentHtml version 1.0.

The following code doesn't work because float is a C# keyword.

<%= this.TextBox(m => m.Name).Styles(float => "left") %>

How do I define the "float" css style using the Styles method in FluentHtml?

Michael Meadows
  • 27,796
  • 4
  • 47
  • 63

1 Answers1

3

prefix the argument with an @.

<%= this.TextBox(m => m.Name).Styles(@float => "left") %>

When using the argument inside the lambda remember to keep verbatim escape the argument.

@float => @float.ToString()
Romano Zumbé
  • 7,893
  • 4
  • 33
  • 55
Martijn Laarman
  • 13,476
  • 44
  • 63