D
Dan Dorey via .NET 247
Hey,
I'm trying to write a generalized report that just takes some SQL as a parameter and then dynamically creates datagrids to display the information.
I can create the datagrid(s) and display the information just fine like so:
Dim newPanel As Panel = New Panel
Dim lblTitle As Label = New Label
Dim dgGen As DataGrid = New DataGrid
'dgGen.AllowSorting = True
newPanel.Controls.Add(lblTitle)
newPanel.Controls.Add(dgGen)
Me.Page.Controls.Add(newPanel)
' Then I bind the datagrid and it works fine... '
However, I need to enable sorting for these datagrids, but I get the following error when I do so:
"Control '_ctl2__ctl1__ctl0' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server."
Thanks in advance,
Dan
I'm trying to write a generalized report that just takes some SQL as a parameter and then dynamically creates datagrids to display the information.
I can create the datagrid(s) and display the information just fine like so:
Dim newPanel As Panel = New Panel
Dim lblTitle As Label = New Label
Dim dgGen As DataGrid = New DataGrid
'dgGen.AllowSorting = True
newPanel.Controls.Add(lblTitle)
newPanel.Controls.Add(dgGen)
Me.Page.Controls.Add(newPanel)
' Then I bind the datagrid and it works fine... '
However, I need to enable sorting for these datagrids, but I get the following error when I do so:
"Control '_ctl2__ctl1__ctl0' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server."
Thanks in advance,
Dan