extra datagrid header...

Discussion in 'ASP .Net Datagrid Control' started by saleek, Jan 17, 2005.

  1. saleek

    saleek Guest

    I was wondering if there is a way I can add an extra header to a datagrid?

    I found this solution on the internet - but it seems quite old and didn't
    work for me.

    http://www.dotnet247.com/247reference/msgs/13/69744.aspx

    It recommends the following:

    Private Sub DataGrid1_PreRender(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles DataGrid1.PreRender
    Dim dgitem As New DataGridItem(0, 0, ListItemType.Header)
    Dim mycell As New TableCell
    mycell.ColumnSpan = 1 'Set it to the colspan that you want
    mycell.Text = "PRESS RADIO TV"
    dgitem.Cells.Add(mycell)
    DataGrid1.Controls(0).Controls.AddAt(0, dgitem)
    End Sub

    But I get an error:

    Specified argument was out of the range of valid values. Parameter name:
    index

    I appreicate your help,


    KS
     
    saleek, Jan 17, 2005
    #1
    1. Advertising

  2. saleek

    Saravana Guest

    Check out this article,
    http://www.extremeexperts.com/Net/Articles/ExtendingDataGrid.aspx

    --
    -Saravana
    http://dotnetjunkies.com/WebLog/saravana/
    www.ExtremeExperts.com



    "saleek" <> wrote in message
    news:...
    > I was wondering if there is a way I can add an extra header to a datagrid?
    >
    > I found this solution on the internet - but it seems quite old and didn't
    > work for me.
    >
    > http://www.dotnet247.com/247reference/msgs/13/69744.aspx
    >
    > It recommends the following:
    >
    > Private Sub DataGrid1_PreRender(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles DataGrid1.PreRender
    > Dim dgitem As New DataGridItem(0, 0, ListItemType.Header)
    > Dim mycell As New TableCell
    > mycell.ColumnSpan = 1 'Set it to the colspan that you want
    > mycell.Text = "PRESS RADIO TV"
    > dgitem.Cells.Add(mycell)
    > DataGrid1.Controls(0).Controls.AddAt(0, dgitem)
    > End Sub
    >
    > But I get an error:
    >
    > Specified argument was out of the range of valid values. Parameter name:
    > index
    >
    > I appreicate your help,
    >
    >
    > KS
    >
    >
     
    Saravana, Jan 18, 2005
    #2
    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. AMD Desktop
    Replies:
    3
    Views:
    1,949
    Steve C. Orr [MVP, MCSD]
    Nov 2, 2004
  2. =?Utf-8?B?c2FsZWVr?=

    DataGrid - adding an extra header...

    =?Utf-8?B?c2FsZWVr?=, Jan 17, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,132
    =?Utf-8?B?c2FsZWVr?=
    Jan 17, 2005
  3. mlt
    Replies:
    2
    Views:
    892
    Jean-Marc Bourguet
    Jan 31, 2009
  4. mathieu
    Replies:
    3
    Views:
    624
    Bo Persson
    Sep 4, 2009
  5. kumaravelan mb via .NET 247

    Extra header in DataGrid

    kumaravelan mb via .NET 247, Mar 9, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    124
    quaester
    Mar 9, 2005
Loading...

Share This Page