problem with dynamically created labels

  • Thread starter Thread starter André
  • Start date Start date
A

André

Hi,

Three labels are dynamically created. If a certain condition is met, then
label 2 must be hidden.
My problem: if the condition is met, with this code here below, there
remains a gap between label1 and label3. I tried to embed them into
tablecells (<td>) and into <div>, but i couldn't eliminate the gap between
label1 and label3. I tried to put lb2.height="0".

Do you know a way for removing the gap and to get:
ok
ok3

instead of
ok

ok3

Thanks
André

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim lb, lb2, lb3 As Label
Dim lit As LiteralControl
lb = New Label
lb2 = New Label
lb3 = New Label
lb.Text = "ok"
lb2.Text = "ok2"
lb3.Text = "ok3"

if ..... then
lb2.Visible = False
lb2.Height = "0"
end if

form1.Controls.Add(lb)
lit = New LiteralControl("<br>")
form1.Controls.Add(lit)
form1.Controls.Add(lb2)
lit = New LiteralControl("<br>")
form1.Controls.Add(lit)
form1.Controls.Add(lb3)
End Sub
 
Back
Top