RE: Datagrid sort
From: ETX (ETX_at_discussions.microsoft.com)
Date: 12/03/04
- Next message: Scott M.: "Re: Why Windows Lost The Battle for the Desktop"
- Previous message: Scott M.: "Re: Why Windows Lost The Battle for the Desktop"
- In reply to: Rakesh Rajan: "RE: Datagrid sort"
- Next in thread: Ben Lucas: "Re: Datagrid sort"
- Reply: Ben Lucas: "Re: Datagrid sort"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Dec 2004 05:39:06 -0800
Thanks Rakesh.
I found other way to keep the datatable stored.
I have cached the resulting datatable and then retrieved it from cache,
this way I do not need to launch the SQL query again. the code was someting
like this:
SQLResults = SQLQuery.execute
'Cahe the resulting datatable.
Cache("DataTableCached") = SQLResults
BindGrid()
Sub BindGrid()
'Retrieve Datasource from Cache
Dim source As DataTable
source = Cache("DataTableCached")
'return a DataView to the DataTable
Dim dv As DataView = New DataView(source)
If SortField Is Nothing Then
SortField = "Title"
End If
dv.Sort = SortField
dg_Results.DataSource = dv
dg_Results.DataBind()
End Sub
"Rakesh Rajan" wrote:
> Hi ETX,
>
> Check out these articles which discuss the same:
> http://msdn.microsoft.com/msdnmag/issues/04/01/CuttingEdge/default.aspx
> http://www.eggheadcafe.com/articles/20021022b.asp
>
> HTH,
> Rakesh Rajan
>
> "ETX" wrote:
>
> > Hello,
> > My question is about the datagrid sorting. I have a datatable that is filled
> > up with the data retrieved from an SQL query.I use that datatable as source
> > for my datagrid. I would like to make the datagrid sortable by each of the
> > columns but I don“t want to run the SQL query again. The problem is that I'm
> > loosing the datatable every time the sorting function is launched. I'm not
> > allowed to use session variables and I don't know how to store the datatable
> > in order that I don't loose it when the sorting is launched.
> > I would be very gratefull if you could post an example of how can I solve
> > this issue.
> > Thnaks a lot.
- Next message: Scott M.: "Re: Why Windows Lost The Battle for the Desktop"
- Previous message: Scott M.: "Re: Why Windows Lost The Battle for the Desktop"
- In reply to: Rakesh Rajan: "RE: Datagrid sort"
- Next in thread: Ben Lucas: "Re: Datagrid sort"
- Reply: Ben Lucas: "Re: Datagrid sort"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|