String.IsNullOrEmpty (string) 'has some invalid arguments

I converted MVC 3.5 to MVC2 4.0, we 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

+3
source share
3 answers

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

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

In .net 4.0. ValidationSummary returnsMvcHtmlString no string, like 3.5.

+7
source

In the new MVC, Html.ValidationSummary () returns an MvcHtmlString, not a regular string. You can use ValidationSummary (). ToString () or ToHtmlString () to make it a string.

0
source

Source: https://habr.com/ru/post/1775744/


All Articles