Hi,
Advise you to have an extra care when using session, cause session expires. When session expire on time the session value becomes null. The good coding is upon page load on your details page, you must store such value of session eg. hidden fields a suggested storage...
You can retrieve session value as example:
example:
session[UserId"] = "MyUserId";
Assuming the name of your hidden field is
hfUserId and upon loading on your display page you must store the value in your hidden field so that the value will not became
null when session expires.
Example:
this.hfUserId.value = session[UserId"] ;
Then you may retrieve the value of hidden field to be use in your select where clause...
Regards,