A
Andrew Jocelyn
Hi
I'm trying to add a cell in the ItemCreated event which appears next to the
Pager cell and contains a label. At the moment I'm getting a 'Multiple
controls with the same ID' exception. I guess this is do to with the Pager
appearing twice, i.e. top and bottom? What's the best way to get around this
problem please? Here's my code so far:
Private Sub DataGrid_ItemCreated(ByVal sender As System.Object, ByVal e As
DataGridItemEventArgs) Handles DataGrid1.ItemCreated
If e.Item.ItemType = ListItemType.Pager Then
Dim pager As TableCell = CType(e.Item.Controls(0), TableCell)
'Additional Pager Text
Dim dgPagerText As New TableCell
dgPagerText.ID = "dgPagerText"
dgPagerText.HorizontalAlign = HorizontalAlign.Right
'Trace.Write("page stats", PageStats.Text)
dgPagerText.Controls.Add(PageStats)
'Add Table Cell to Pager
e.Item.Controls.AddAt(0, dgPagerText)
End If
End Sub
Many thanks
Andrew
I'm trying to add a cell in the ItemCreated event which appears next to the
Pager cell and contains a label. At the moment I'm getting a 'Multiple
controls with the same ID' exception. I guess this is do to with the Pager
appearing twice, i.e. top and bottom? What's the best way to get around this
problem please? Here's my code so far:
Private Sub DataGrid_ItemCreated(ByVal sender As System.Object, ByVal e As
DataGridItemEventArgs) Handles DataGrid1.ItemCreated
If e.Item.ItemType = ListItemType.Pager Then
Dim pager As TableCell = CType(e.Item.Controls(0), TableCell)
'Additional Pager Text
Dim dgPagerText As New TableCell
dgPagerText.ID = "dgPagerText"
dgPagerText.HorizontalAlign = HorizontalAlign.Right
'Trace.Write("page stats", PageStats.Text)
dgPagerText.Controls.Add(PageStats)
'Add Table Cell to Pager
e.Item.Controls.AddAt(0, dgPagerText)
End If
End Sub
Many thanks
Andrew