I'm trying to add dynamically controls to my WebForms control
ASP:Panel in such way:
1). First of all, I'm defining some Literals in such way:
Literal paragraphBegin = new Literal(); paragraphBegin.Text = "<p>"; Literal paragraphEnd = new Literal(); paragraphEnd.Text = "</p>"; Literal breakLine = new Literal(); breakLine.Text = "<br />";
2). I have already defined Panel, which updates its content and I'm adding new items to it, like this:
this.contentViewWebdata.Controls.Add(labelUserGuid); this.contentViewWebdata.Controls.Add(editableUserGuid); this.contentViewWebdata.Controls.Add(breakLine);
3). Literals paragraphBegin && paragraphEnd are adding well, but not the breakLine
Literal and I don't understand clearly - why isn't it adding?
The final problem occurs with the method in CodeBehind:
And the final result does look like:
As you see,
Literal, which implements
<br /> doesn't work at all. So, I also have tried to add some
Literals firstly to the .Controls of
Label (which is
<span>, and which I thought will keep
<br /> in its body), but also no success.
What I'm suppose to do, if I want to fix my issue?