|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sorting Datagridnew DataTable, correct? So, if on the load of the page, you do something like this: 'adosDS & AdoConn are global in this instance Dim adoSelect As New SqlCommand Dim adoDa As New SqlDataAdapter adoSelect.CommandType = CommandType.StoredProcedure adoSelect.CommandText = "MG_SelectTMLSAssignments" adoSelect.Connection = adoConn adoDa.SelectCommand = adoSelect adoDa.Fill(adoDS, "Assignments") dgTMLSAssignments.DataSource = adoDS.Tables("Assignments").DefaultView dgTMLSAssignments.DataBind() You'd have to do the same thing essentially over again, in the SortCommand event of the datagrid, correct? The ASP.Net tutorial here: http://www.asp.net/QuickStart/howto/doc/adoplus/FilterData.aspx says you need only create a new dataview and set the Sort property, this however doesn't work, generating the error: DataTable must be set prior to using DataView So...either I just don't get it, or Microsoft's example is incomplete and/or erroneous. Yes in essence you do have to retrieve your data in some way again, if
it is a small amount of data you could store it in session or in viewstate instead of going back to your database everytime the page postsback. The datatable needs to be populated everytime you wish to create a dataview of the data within it. Microsofts example is incomplete for that. Try looking at this full tutorial for your issue http://aspnet.4guysfromrolla.com/articles/040502-1.aspx Regards, Pete
MyGridView cause "Columes" lose the intellisense in VS2005 IDE!
CompositeControl and Toolbox A socket operation was attempted to an unreachable network ID of web control changed Can i Make a Month Column Display May instead of 5 2.0 TreeNode How to get dynamic control's value after postback? Custom Panel How to upload files to a remote webserver using FileUpload ? MetaBuilders DualList control does not work in 2.0 |
|||||||||||||||||||||||