this code works but the text boxes and labels go across the page instead of up and down in 2 columns
DougP
Code:
label1[ ] label2[ ] label3[ ] label4[ ]
label5[ ] label6[ ] label7[ ] label8[ ]
I need it to go down like this: what am I doing wrong?
label1[ ] label5[ ]
label2[ ] label6[ ]
label3[ ] label7[ ]
label4[ ] label8[ ]
Code:
Dim objComm As SqlCommand
Dim objReader As SqlDataReader
' Dim strSQL As String = "Select top 1 FieldName from forms_Main Order by UniqueID"
Dim strSQL As String = "Select FieldName from forms_Main Where FormName = '" & Session("formsProLoadForm") & "'"
strConn.Open()
objComm = New SqlCommand(strSQL, strConn)
objReader = objComm.ExecuteReader()
If objReader.HasRows Then
ThePlaceHolderContainer.Controls.Add(New LiteralControl("<asp:Table ID='Table1' runat='server'>"))
Do While objReader.Read()
' Create a new Label, set the properties, and add to placeholder
TheRecordLabel = New Label
ThePlaceHolderContainer.Controls.Add(New LiteralControl("<asp:TableRow>"))
ThePlaceHolderContainer.Controls.Add(New LiteralControl("<asp:TableCell>"))
TheRecordLabel.ID = "lbl_" & objReader.GetString(0)
TheRecordLabel.Text = objReader.GetString(0)
ThePlaceHolderContainer.Controls.Add(TheRecordLabel)
ThePlaceHolderContainer.Controls.Add(New LiteralControl("</asp:TableCell>"))
ThePlaceHolderContainer.Controls.Add(New LiteralControl("<asp:TableCell>"))
' Create a new textbox, set the properties, and add to placehodler
TheRecordTextBox = New TextBox()
TheRecordTextBox.ID = "txt_" & objReader.GetString(0)
'TheRecordTextBox.Style.
TheRecordTextBox.Text = ""
ThePlaceHolderContainer.Controls.Add(TheRecordTextBox)
'ThePlaceHolderContainer.Controls.Add(New LiteralControl("<br />"))
ThePlaceHolderContainer.Controls.Add(New LiteralControl("</asp:TableCell>"))
ThePlaceHolderContainer.Controls.Add(New LiteralControl("</asp:TableRow>"))
Loop
ThePlaceHolderContainer.Controls.Add(New LiteralControl("</asp:Table>"))
End If
' Add the placeholder to the Content Control (from Master)
TheMasterContentControl.Controls.Add(ThePlaceHolderContainer)
DougP