dynamic datagrids and allowsorting

  • Thread starter Dan Dorey via .NET 247
  • Start date
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
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top