mardi 4 août 2015

Changing the color of a texbox with a table cell VB ASP.Net

I have created a textbox within a cell of a table and I am using this to take input from a user and display it on a webpage. I however cant get the background of the textbox to change when the user clicks in side the textbox, normally I would use simple CSS for this but as the textbox is inside a table cell I cant seem to be able to work out how to do this. Any Ideas on how to approach this?

I have the following VB code to generate and populate my table.

VB

 Protected Sub GenerateTable(noOfRows As Integer)
    Dim table As Table
    Dim row As TableRow
    Dim cell As TableCell
    Dim tb As TextBox
    Dim lbl As Label
    table = Table1
    table.ID = "Table1"

    For i As Integer = 1 To noOfRows Step 1
        row = New TableRow()
        For j As Integer = 0 To 1 Step 1
            cell = New TableCell()
            If j = 1 Then
                tb = New TextBox()
                tb.ID = "TextBoxRow_" & i & "Col_" & j
                cell.Controls.Add(tb)

            ElseIf j = 0 Then
                lbl = New Label()
                lbl.ID = "Label" & i
                lbl.Text = "Volume " & i
                cell.Controls.Add(lbl)
            End If
            row.Cells.Add(cell)
        Next
        table.Rows.Add(row)
    Next
    ViewState("RowsCount") = noOfRows
    Session("RowsCount") = noOfRows
End Sub

HTML

<tr>
    <td colspan="2">
        <asp:Table class="Table1" ID="Table1" runat="server"></asp:Table>

        <br />
            <asp:Button ID="btnAddVolume" class="btnVolumeBreak" runat="server"  Text="Add Volume Break"/>
    </td>
</tr>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire