I've searched around on how to get a ViewComponent as a string.
I found the method to do it in .cshtml razor like this:
var writer = new System.IO.StringWriter(new System.Text.StringBuilder()); (await Component.InvokeAsync(typeof(MyViewComp))).WriteTo(writer, HtmlEncoder.Default); string viewCompString = writer.ToString();
But i cant do this in the backend, because the Component object is derived from razor that you can get in .cshtml, but not in the controller (i think).
Any help appreciated! :)