Please Help - Dynamically Creating Datagrids

Discussion in 'ASP .Net Datagrid Control' started by Jamie Sutherland, Apr 20, 2004.

  1. 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
    Jamie Sutherland, Apr 20, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shane O'Keeffe

    Dynamically positioning DataGrids

    Shane O'Keeffe, Aug 3, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    536
    Shane O'Keeffe
    Aug 4, 2004
  2. Jim Bancroft
    Replies:
    3
    Views:
    387
    Jim Bancroft
    Dec 20, 2004
  3. sJeev via DotNetMonster.com

    Help Please! Can't edit my datagrids/get the right content

    sJeev via DotNetMonster.com, Jan 27, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    289
    sJeev via DotNetMonster.com
    Jan 27, 2005
  4. =?Utf-8?B?SSBhbSBTYW0=?=

    Datagrids are kicking my ass!! Please help

    =?Utf-8?B?SSBhbSBTYW0=?=, Mar 14, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    402
    JohnFol
    Mar 14, 2005
  5. KK
    Replies:
    2
    Views:
    545
    Big Brian
    Oct 14, 2003
Loading...

Share This Page