shankar123
New member
- Joined
- Aug 10, 2022
- Messages
- 2
- Programming Experience
- 1-3
I have defined few shortCode in Database. When i am displaying in view, ShortCode not replacing with the PartalView defined in the Dictionary.
In Database i am creating a field Description. There i am storing HTML text along with Few Short code. When i display Description in view. I want the short Code to replace with Partial view. Like we do in WordPress/Joomla. In Database i define ShortCode. I want that sortCode replaced with PartialView.
This is the message i am getting on the screen microsoft.AspNetCore.Mvc.ViewFeatures.Buffers.ViewBuffer
In Database i am creating a field Description. There i am storing HTML text along with Few Short code. When i display Description in view. I want the short Code to replace with Partial view. Like we do in WordPress/Joomla. In Database i define ShortCode. I want that sortCode replaced with PartialView.
This is the message i am getting on the screen microsoft.AspNetCore.Mvc.ViewFeatures.Buffers.ViewBuffer
C#:
@{
var input = "<div>Hello This is Same</div><div>{partv _AllPages}</div><div>Some Content</div><div>{partv _AllPost}</div>";
var replacements = new Dictionary<string, string>
{
{ "{partv _AllPages}", Html.Partial("_AllPages").ToString()},
{ "{partv _AllPost}", Html.Partial("_AllPost").ToString()}
};
var output = replacements.Aggregate(input, (current, replacement) => current.Replace(replacement.Key, replacement.Value));
}
@Html.Raw(HttpUtility.HtmlDecode(output))
Last edited by a moderator: