Cameron Castillo
Cameron Castillo

Reputation: 2832

Replace placeholder tags in HTML with values from code

I have an HTML table in asp.net with placeholder tags, like #value1# and #value2#. The tags are currently the text in the <td> element.

In C# I would like to replace these text with values that I calculate from code. What is the best method to replace the HTML tags from C#?

Upvotes: 0

Views: 1579

Answers (1)

Grant Thomas
Grant Thomas

Reputation: 45083

Make the placeholders Literal controls and output the value to the Text property:

<asp:Literal runat="server" ID="PlaceHolder1" />

PlaceHolder1.Text = "content that would replace placeholder text";

Upvotes: 1

Related Questions