Overview
I have a routine that produces a basic HTML page. This page
contains a piece of code like:
<input type="text" asp-for="ModelValue" />
So, the above code is embedded in an HTML value that is *inside* another
string
, which I am passing into the view and doing:
@Html.Raw(Model.MyHTMLString)
The Problem:
My issue is that the string inside the model that I am trying to surface isn't resolving the "
asp-for
" tags.
My question(s):
- How can I manually call for the processor to execute after I've presented this HTML on the view?
- Alternatively, how can I take the HTML that I am generating and prepare it BEFORE I send it to
@Html.Raw
?
- Or even other alternatively, how else can I approach this?
What I've tried:
- parsing through a partial view
- parsing through
SetHtmlContent(my string)
- parsing through
SetContent(my string)
(wow, was that a mess...)
- sending my string through without using
Html.Raw
(no effect - same as using it)
Other Disclaimers
I'm new at using views in .NET. I'm normally an MC guy, not an MVC guy. I do a lot of C# coding, but not so much HTML. I mean, I "get" HTML somewhat, but would normally build it by hand (Old school.)
Any help that anyone can give would be VERY greatly appreciated.
Thanks.
-J
What I have tried:
- parsing through a partial view
- parsing through
SetHtmlContent(my string)
- parsing through
SetContent(my string)
(wow, was that a mess...)
- sending my
string
through without using Html.Raw
(no effect - same as using it)
Edit: I think I'm understanding part of my problem...
It would seem that what's happening is that my markdown is rendering effectively "in order" of what's on the Razor page. And since the markdown isn't "aware" of the model, it can't offer much in the way of help for that. I think I need to incorporate my own tag handling inside the markdown... Thoughts?