Please Help - Dynamically Creating Datagrids

J

Jamie Sutherland

Hi,
Below is a piece of my code. What it does is displays datagrids on my
webpage. That part works ok it displays the data including the filtered. But
what it does is creates each table below one another. How do I get it to
either displayed next to each other (TABLE1 | TABLE2 | TABLE3) or Below one
another but with "<p></p>" tages in between each table .
Please help
Thanks
Jamie

Function CreateDataGrid(ByVal category As String)
' Create Row Filter for Categories
Dim dvCat As New DataView(ds.Tables("Links"))
dvCat.RowFilter = "Category='" & category & "'"

' Dynamically create the Datagrid
Dim dgLinks As New DataGrid
dgLinks.DataSource = dvCat
dgLinks.ItemStyle.BackColor = Color.AliceBlue
dgLinks.AlternatingItemStyle.BackColor = Color.Azure
dgLinks.Width = Unit.Pixel(200)
dgLinks.HeaderStyle.BackColor = Color.DarkBlue
dgLinks.HeaderStyle.ForeColor = Color.White
dgLinks.HeaderStyle.Font.Bold = True

' Set up the columns collection programatically, not Automatically
dgLinks.AutoGenerateColumns = False

' Add a hyperlink column
Dim hlc As New HyperLinkColumn
hlc.HeaderText = category
hlc.DataTextField = "Link_Title"

hlc.DataNavigateUrlField = "URL"
dgLinks.Columns.Add(hlc)

' Dynamically Add DataGrid into the Page
Page.Controls.Add(dgLinks)
dgLinks.DataBind()
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top