Question

 Dim table1 As New HtmlTable
 Table1.Border = "1"
 Table1.BorderColor = "Blue"
        For j As Integer = 0 To 2
            Dim row As New HtmlTableRow()
            Dim cell1 As New HtmlTableCell()
            Dim cell2 As New HtmlTableCell()
            Dim rbl As New RadioButtonList()
            For RowIndex As Integer = 0 To 2
                rbl.ID = RowIndex
                rbl.Items.Add("Hi")
                Dim lbl1 As New Label()
                lbl1.ID = "Hi" + RowIndex.ToString
                lbl1.Text = "hello"
                lbl1.Height = "25"
                cell2.Controls.Add(lbl1)

                cell2.Controls.Add(new LiteralControl("<br />"))
            Next
            cell1.Controls.Add(rbl)
            row.Cells.Add(cell1)
            row.Cells.Add(cell2)
            table1.Rows.Add(row)
        Next
        PlaceHolder1.Controls.Add(table1)

In the above code the border appears for Rows and cell and to the whole table, but what i need is the border should appear for only row and not in the cells.

Edit when added this line the row color works

row.Attributes.Add("style", "outline: thin solid blue;")

but the line diappears on double click inside the table..!!

Était-ce utile?

La solution

You can try the Outline style for the Row.

You need to add it using attributes.add() method.

Remove border setting for the Table1

See Complete code as below:

Dim table1 As New HtmlTable
        'table1.Border = "1"
        'table1.BorderColor = "Blue"
        For j As Integer = 0 To 2
            Dim row As New HtmlTableRow()
            Dim cell1 As New HtmlTableCell()
            Dim cell2 As New HtmlTableCell()
            Dim rbl As New RadioButtonList()

            row.Attributes.Add("style", "outline: thin solid blue;")
            For RowIndex As Integer = 0 To 2
                rbl.ID = RowIndex
                rbl.Items.Add("Hi")
                Dim lbl1 As New Label()
                lbl1.ID = "Hi" + RowIndex.ToString
                lbl1.Text = "hello"
                lbl1.Height = "25"
                cell2.Controls.Add(lbl1)

                'Add This
                cell2.Controls.Add(New LiteralControl("<br />"))
            Next
            cell1.Controls.Add(rbl)
            row.Cells.Add(cell1)
            row.Cells.Add(cell2)
            table1.Rows.Add(row)
        Next
        PlaceHolder1.Controls.Add(table1)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top