One easy (but very lazy) way to do this is to sync the SessionID in an actual Session field and then use a SessionParameter as the parameter for the data source control. E.g. put the following in Session_Start:
Session("Id") = Session.SessionID
Then in the data source use this:
<asp:SessionParameter Name="CartID" SessionField="Id" />
This gets the value of a Session field called ID (which has been synced from the Session.SessionID).
Alternatively, you can write a handler for the Selecting command of the data source and then fill the parameter with the value from Session.SessionID.
There's a lot to this kind of programming, so you may need to read up a little about how controls like the GridView and the SqlDataSource work and what they're capable of....
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.