Prev: Login Redirection
Next: FileUploaderAjax
From: Crouchie1998 on 24 Sep 2010 17:47 I altered the code below but also used a sqldatareader to populate the 5 column, 11 row table "Crouchie1998" wrote: > Hi All, > > Am using VS2010 with Framework 4.0 in VB.NET > > I have a table which I wish to create on page load which isn't database driven > > I can create the table single column using new LinkLabel controls but I wish > to have the links in 3 or 4 columns, not just one. Example > > At the moment: > > LinkLabel1 > LinkLabel2 > LinkLabel3 > LinkLabel4 > LinkLabel4 > LinkLabel6 > ... > > Would like them: > > LinkLabel1 LinkLabel2 LinkLabel3 > LinkLabel4 LinkLabel5 LinkLabel6 > ... > > This is the code I have so far, taken from an example & changed for my > requirements: > > Private Sub CreateRootTable() > PlaceHolder1.Controls.Clear() > > Dim tblRows As Integer = 60 > Dim tblCols As Integer = 1 ' Changing to 3 just repeats the same > link 3 times > Dim tbl As Table = New Table() > PlaceHolder1.Controls.Add(tbl) > For i As Integer = 0 To tblRows - 1 > Dim tr As TableRow = New TableRow() > For j As Integer = 0 To tblCols - 1 > Dim tc As TableCell = New TableCell() > Dim hl As HyperLink = New HyperLink() > hl.Text = "Some Text Here " & (i + 1) > hl.ToolTip = "Click here to download" > hl.NavigateUrl = "/URL HERE" > hl.Font.Underline = False > hl.Font.Size = FontUnit.Medium > ' hl.Target = "_self" > tc.Controls.Add(hl) > tr.Cells.Add(tc) > Next j > tbl.Rows.Add(tr) > Next i > > ViewState("dynamictable") = True > End Sub > > Changing the column variable to 3 just does the following > > LinkLabel1 LinkLabel1 LinkLabel1 > LinkLabel2 LinkLabel2 LinkLabel2 > LinkLabel3 LinkLabel3 LinkLabel3 > LinkLabel4 LinkLabel4 LinkLabel4 > LinkLabel5 LinkLabel5 LinkLabel5 > LinkLabel6 LinkLabel6 LinkLabel6 > > When I am looking to centre them and space them equally on screen like so: > > LinkLabel1 LinkLabel2 > LinkLabel3 > LinkLabel4 LinkLabel5 > LinkLabel6 > > Please help > > Thanks in advance
|
Pages: 1 Prev: Login Redirection Next: FileUploaderAjax |