C# – string.IsNullOrEmpty(string)’ has some invalid arguments

asp.net-mvc-2c

I converted MVC 3.5 to MVC2 4.0, get an error The best overloaded method match for 'string.IsNullOrEmpty(string)' has some invalid arguments
Here is my code:

<% if (this.Model.VisitId == 0) { %>
        mustSave = true;
    <% } else { %>
        mustSave = false;
    <% } %>
    <% if (String.IsNullOrEmpty(Html.ValidationSummary())) { %>
        dataChanged = false;
    <% } else { %>
        dataChanged = true;
    <% } %>

Thanks in advance

Best Answer

Html.ValidationSummary() returns MvcHtmlString, not a normal string. So, try this:

<% if (MvcHtmlString.IsNullOrEmpty(Html.ValidationSummary())) { %>