Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert a <br /> tag programmatically (VB.NET)

I'm trying to dynamically add results to this display and I simply want to put a break tag after a label to start putting information on the next line. For some reason, Using a literal isn't working for me. Is there a better way to do this or should I just use tables?

Dim break As LiteralControl
break = New LiteralControl("<br />")
divListenerInfo.Controls.Add(break)

That's part of the code that I'm attempting to use.


Let me clarify what I said:

It's not working as in the line break isn't showing up on the webpage. It's compiling fine and there is nothing wrong with the code. It just doesn't show up in the html for some odd reason.

like image 516
Paxenos Avatar asked Apr 28 '09 18:04

Paxenos


2 Answers

The proper control to use is the HtmlGenericControl.

Dim br As New HtmlGenericControl("br")

You can use the HtmlGenericControl to render any HTML element you wish, simply pass the element's tag name as a single argument to the constructor.

like image 154
Andrew Hare Avatar answered Nov 20 '22 20:11

Andrew Hare


Why not just use another label, or append the <br> to the previous label.txt?

like image 2
madcolor Avatar answered Nov 20 '22 20:11

madcolor