drawing a line or rule programmatically in a web form

Discussion in 'ASP .Net' started by yer darn tootin, Mar 6, 2005.

  1. 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
     
    yer darn tootin, Mar 6, 2005
    #1
    1. Advertising

  2. Bob,

    You should set row border with css rules.

    Eliyahu

    "yer darn tootin" <> wrote in message
    news:...
    > 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
    >
     
    Eliyahu Goldin, Mar 6, 2005
    #2
    1. Advertising

  3. 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)
     
    yer darn tootin, Mar 6, 2005
    #3
  4. 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)
     
    yer darn tootin, Mar 6, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris R. Timmons
    Replies:
    0
    Views:
    691
    Chris R. Timmons
    Aug 29, 2003
  2. Replies:
    1
    Views:
    686
    Kevin Spencer
    Jan 9, 2006
  3. Replies:
    0
    Views:
    1,414
  4. Replies:
    1
    Views:
    334
    Roedy Green
    Dec 6, 2007
  5. defn noob
    Replies:
    1
    Views:
    432
    Mark Space
    Jun 28, 2008
Loading...

Share This Page