drawing a line or rule programmatically in a web form
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
Re: drawing a line or rule programmatically in a web form
Bob,
You should set row border with css rules.
Eliyahu
"yer darn tootin" <bob_nospam_3000 [at] yahoo.com> wrote in message
news:1110103226.531939.69870 [at] g14g2000cwa.googlegroups.com...
> 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
>
Re: drawing a line or rule programmatically in a web form
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)
Re: drawing a line or rule programmatically in a web form
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)