Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Replace tags for html content

$
0
0

That's how if I have some content that I want to replace from a tag to html content how do I add html content to the site I've written it takes her.

fx:

<p> hello world </p><p> hello world </p><p> hello world </p><p>{{alert}}</p>

Where I've written alert there, then it will get a video that is in my block's table.

{{alert}} ---> <div class="alert alert-success"> <strong>Success!</strong> Indicates a successful or positive action. </div>

var listBlocks = _dbContext.Blocks.ToList();//Get {{banner}} herevar text = _dbContext.ContentInfo.FirstOrDefault(i => i.Id==1).ContentText;//text contentfor(int i =0; i < listBlocks.Count; i++){if(listBlocks[i].Tag.Equals(text)){
        text += text.Replace(listBlocks[i].Tag, listBlocks[i].Value);}//How can I do this?}

It must be alike. where I have written her, it just replaces the point I have written

No matter where tag is, it should replace it as it is in the block table.


Viewing all articles
Browse latest Browse all 9386

Trending Articles