Click here to Skip to main content
11,581,402 members (61,314 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
I have a formatted string that contains a description of an item (I'm using an extended RFT Editor then converting to HTML). I want to then insert that description into another field that contains HTML. I imagined using a placeholder of some sort in the HTML, but I'd be happy with another solution.

For example in pseudo html:

The RTF formatted string will be converted to HTML, but the location of the insertion may change if I alter the HTML so using indexes etc is probably out.

The result will be a HTML template common to all records with placeholders, which is then used to build the display with the specific description embedded in the proper place for each record whe I upload to my website.

Any ideas on how to do this? I considered doing a straight find replace but wanted to know if there's a better way?
Posted 24-Apr-14 23:27pm
gggustafson at 25-Apr-14 13:05pm
Have you considered using a class (and possibly an id) in your HTML for the placeholders? That way you do not rely on indices. I wrote an article Revised Green Links that does that.
Member 10773666 at 26-Apr-14 10:17am
Thanks for the fast response GG. I had a look at your green links article, but thats not what I want to do. Basically I am looking for a way to template a webpage and insert an items description (in HTML) in to the page. After reading your green links article I looked also at your master pages one with javascript and that one might do the trick. I'll have a p[lay with it and see if it will work. I don't have control of the page when it is uploaded, so they might not allow javascript to make cross domain calls, since I can't add the header and footer text files to the site. It gives me a good idea of where to start anyway :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 340
1 Sergey Alexandrovich Kryukov 155
2 virusstorm 114
3 Frankie-C 105
4 RyanDev 84
0 OriginalGriff 1,273
1 Sergey Alexandrovich Kryukov 895
2 Abhinav S 597
3 F-ES Sitecore 500
4 Suvendu Shekhar Giri 433

Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 25 Apr 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100