Dynamic Tables

moc2469

Active member
Joined
Jun 21, 2007
Messages
27
Programming Experience
1-3
Hi,

I have a Schedule Program that when a Manager wants to edit a schedule they click the Edit Schedule button, a window opens with choice of weekending date, and a store or an employee. At this point they click Get Schedule and are redirected to a new page. On this last page in the Init section(before Page_Load) I am calling to the database, filling a datatable, counting the rows, and then I should be able to dynamically create the html table(s) I need for them to do editing in. When it is for just one employee it works right, but when it is for more than one(say 4), it's like 4 tables are on top of each other.

How would I fix this?

Here is the method call:
VB.NET:
Private Sub Create_Tables()
        'Dynamically create tables
        Dim dr As DataRow
        Dim iCount As Int16 = 0

        'Set Tables
        For Each dr In dt.Rows
            Response.Write("<table id='table" & [COLOR="Red"]iCount[/COLOR] _
& "' style='Z-INDEX: 104; LEFT: 8px; WIDTH: 976px; POSITION: absolute; TOP: 96px; HEIGHT: 40px " & _
                "borderColor='black' height='40' cellSpacing='1' cellPadding='1' width='976' border='1' runat = 'server'><tr>")
            Response.Write("<td style='WIDTH: 250px' borderColor='black'><STRONG>Name: </STRONG>" & dt.Rows(iCount).Item("Employee") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'></td>")
            Response.Write("</tr><tr>")
            Response.Write("<td style='WIDTH: 290px' borderColor='black' align='center'><STRONG>Start:</STRONG></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D1_START") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D2_START") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D3_START") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D4_START") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D5_START") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D6_START") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D7_START") & "</td>")
            Response.Write("</tr><tr>")
            Response.Write("<td style='WIDTH: 290px' borderColor='black' align='center'><STRONG>Finish:</STRONG></td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D1_FINISH") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D2_FINISH") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D3_FINISH") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D4_FINISH") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D5_FINISH") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D6_FINISH") & "</td>")
            Response.Write("<td style='WIDTH: 100px' borderColor='black' align='center'>" & dt.Rows(iCount).Item("sch_D7_FINISH") & "</td>")
            Response.Write("</tr></table>")
            iCount = iCount + 1
        Next
    End Sub
 
I figured it out....I was not paying attention to the absolute position of the table.
 
Back
Top