R – LinqDataSource – how to select rows based on the current UserId

gridviewguidlinqdatasourceuseridwhere

I have a Grid View control that displays data based on what is returned by the LinqDataSource. The LinqDataSource selects data depending on the date chosen in a date control (used in the where clause), but I also need the where clause to be based on the current userID which is a GUID.

How can I get the LinqDataSource to obtain the Current User ID and use it in the where clause? My code currently looks like something like this (in the .aspx page)

Where=UserID == GUID?(@UserID)

<asp:Parameter DbType="Guid" Name="UserId" />

I hope that's enough information – please let me know if you need more! 🙂

Thanks 🙂

Best Answer

If anyone is interested, I stopped using the smart tag and ended up writing the query in the _Selecting event of the LinqDataSource. That seemed to fix it.

Related Topic