I have a report that contains a drop down of users. I want the currently logged in user to be selected as a default.
The drop down has a value of UserId and UserName. I have attempted the following but no luck:
ReportViewer.ServerReport.SetParameters(new ReportParameter("SelectedUserId", CurrentUser.Id.ToString()));
I can do this with JavaScript as a last resort, but is there a way to do this server side?
Thanks
Update:
UserId is the primary key of the user table and is not derivable from the logged in user name.. is this what you are suggesting?
Didn't realise I could put a query in there though. I do have CurrentUserId as an internal parameter that I am using as a parameter of my SP that populates the drop down.
I use this to set the default to: =Parameters!CurrentUserId.Value
which does work in Visual Studio and the report manager with a default CurrentUserId. However in the report the CurrentUserId is set with:
ReportViewer.ServerReport.SetParameters(new ReportParameter("CurrentUserId", CurrentUser.Id.ToString()));
which appears to be setting it too late for it to be set in the drop down.