ASP.NET MVC "The call is ambiguous" Error (System.IO.TextWriter.Write)

Viewed 9992

I am creating a dynamic CSS file in ASP.NET MVC2, and I'm now encountering an exception. Everything was working fine, but all of a sudden I'm getting this error message for 2 variables:

The call is ambiguous between the following methods or properties: 'System.IO.TextWriter.Write(string, params object[])' and 'System.IO.TextWriter.Write(char[])'

An example of the code is:

#pageMaster .CCResultsText2 { 
    font-size: <%= ViewData.Model.FontSize %>; 
    color: <%= ViewData.Model.FontColor %>; 
}

This error gets resolved, however, when I replace <%= ViewData.Model.FontColor %> with <% Response.Write(ViewData.Model.FontColor); %>

It seems that there seems to be some kind of issue differentiating the two different forms of the System.IO.TextWriter.Write method, but I'm not exactly sure what I can do besides write out the Response.Write method.

2 Answers
Related