A few days ago i asked a question regarding the possibility to add runat="server" attributes in RTF fields and since it does not seem to be possible. I've chosen to add a HTML5 attribute (allowed in RTF fields) and reformat in C# in TBB:

I use the following block of code :

 //get output item from the package
Item outputItem = package.GetByName(Package.OutputName);
string uglyOutput = outputItem.GetAsString();
string fixedOutput = uglyOutput .Replace("data=\"server\"","runat=\"server\"");
package.PushItem(Package.OutputName, outputItem);

I tested it with template builder and it works well but i don't know why, when i publish the page in question, it no longer works. The "replace" does not work. I'm sure to use the correct template page so i don't know what's wrong. if anyone has an idea. thanks for your help

EDIT: this TBB is placed as last in the TBB pipeline. I tried to check if something else could create this problem but i didn't find anything. I think i would have got it with the template builder anyway. This is a page template.

  • is this replace TBB the last TBB in the pipeline, it could be that a TBB coming after it would still strip the runat attribute for whatever reason. Although I would expect that to then also happen in the Template Builder. Jul 7, 2016 at 12:13
  • I don't follow you, what do you suggest to replace ?
    – user1178
    Jul 7, 2016 at 12:28
  • I have the feeling tridion really does NOT like runat="server" cause when i try to replace for example data-runat="server" to runat1="server", it works! With runat="server" it never works.
    – user1178
    Jul 7, 2016 at 13:21
  • Can you edit your question and provide some info about the pipeline of TBBs and where your custom TBB is in it and which others there are in your template? Also if this is a component or page template TBB? Jul 7, 2016 at 13:29
  • 1
    What output format is the template? (HTML Fragment, ASCX, etc.)
    – Nate Niemi
    Jul 7, 2016 at 15:48

1 Answer 1


One issue I can think of, for this working in the Template Builder and not when you publish is that your Template is not checked in.

When you publish, only the last checked in version of the Template is being rendered, while when you preview (via the CME or the Template Builder), a checked out version will be used if available.

  • thank for your answer! what do you mean with " checked in " ? saved ?
    – user1178
    Jul 7, 2016 at 11:32
  • Saved and closed, content items and templates have version control. When you open them they are checked out, when you save and close they are automatically checked in. If you only save then they remain checked out, i.e. locked for other users Jul 7, 2016 at 11:37
  • It was a nice try indeed but it does not solve my problem... i will keep searching
    – user1178
    Jul 7, 2016 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.