0

I am using string generated by the razor version of the method from:

Render a view as a string

But it does not include errors added to ModelState on the server side.

When I checked it:

Variable viewContext is correct - its property ViewData.ModelState contains errors, but after:

viewResult.View.Render( viewContext, sw );
the string in sw variable contains html without error messages etc ( I mean it is html which should be generated for ModelState without errors).

Is there a way to correct it ?

Community
  • 1
  • 1
user3057544
  • 807
  • 9
  • 22

1 Answers1

0

My mistake.

The method Render a view as a string works correctly.

The reason ViewModel errors where not shown is typo in the field name to which error should be joined.

Community
  • 1
  • 1
user3057544
  • 807
  • 9
  • 22