views:

129

answers:

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?

+2  A: 

prefix the argument with an @.

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

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

@float => @float.ToString()
Martijn Laarman
That worked beautifully. Thanks.
Michael Meadows