drawing a line or rule programmatically in a web form

  • Thread starter yer darn tootin
  • Start date
Y

yer darn tootin

I have a page which displays a table that's being created in the code
behind, where the size of the table dependes on the amount of data
being returned ( eg it could contain one, three or fifty 'apples',
depending ).
All is fine there but I want to draw a dividing line between each
'apple' as it were, yet I'm finding it hard to get a handle on how to
do this!
Is there a way to put the html <HR> horizontal rule in the code behind
so it gets drawn on each loop, or should I be looking at using the
Drawing2D namespace?

Thanks for any tips,
Bob
 
Y

yer darn tootin

Thanks, I tried that on your suggestion but it isn't quite what I need.


The number of rows that make up the table is not set, it's different
each time depending on the number of items returned ( see below )


Private Sub LoadHeader(ByVal iItemID As Integer)

Dim oDS As New DataSet

oDS = oDal.ItemNo_ReadHeader(iLogID)
Dim oRW As DataRow
oRW = oDS.Tables(0).Rows(0)

With tblPrint

' need to put a horizontal rule in here, as we loop back
for each Item...

r = New TableRow
c = New TableCell

c.Controls.Add(New LiteralControl("Item Number"))
r.Cells.Add(c)

c = New TableCell

c.Controls.Add(New LiteralControl(oRW.Item("ItemNo")))

r.Cells.Add(c)
.Rows.Add(r)
 
Y

yer darn tootin

I stumbled across the answer.... I was looking on MSDN at the
Control.Controls
property and saw this code example : Controls.Add(New
LiteralControl("<h3>Value: "))
( This is what I was looking for really, a way to render a HTML control
from within the code behind.)

With the example above I went and changed the "<h3>Value: " to "<hr>"
and it worked!

'Insert dummy row into table as a horizontal rule

r = New TableRow
c = New TableCell
c.ColumnSpan = 4
c.Controls.Add(New LiteralControl("<hr>"))
c.Width = Unit.Percentage(100)
r.Cells.Add(c)
.Rows.Add(r)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top