By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Sort Datagrid by Dynamic Column

P: 40
I have a dataGrid that is populated by SQL table. The Datagrid has two dynamic columns - that I created to for calculations. I want to sort the grid on frmload by one of the dynamic columns is that possible - if so; what will be the best way to do this?

Expand|Select|Wrap|Line Numbers
  1.  Dim command1 As New SqlCommand("Select * FROM LateOrders_query_view order by requested_date desc", cnn1)
  2. Dim SqlReader As SqlDataReader
  3. cnn1.Open()
  5. Dim dt As New DataTable("LateOrders_query_view")
  6. Dim DirAdapter As New SqlDataAdapter(command1)
  7. DirAdapter.Fill(MyDataSet, "LateOrders_query_view")
  9. dgOrderReport.DataSource = MyDataSet.Tables("LateOrders_query_view").DefaultView
  11. 'Create Dynamic Columns call related function
  12. Dim dc As DataColumn
  13. dc = New DataColumn("Days Open") ', Type.GetType("System.double"))
  14. MyDataSet.Tables(0).Columns.Add(dc)
  15. fncGetOpenDays()
  17. Dim dc2 As DataColumn
  18. dc2 = New DataColumn("Days Late")
  19. MyDataSet.Tables(0).Columns.Add(dc2)
  20. fncGetDays()
Is there away for me to sort by a dynamic column (the dynamic column is not part of my table in the database)
Aug 31 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.