locked
How to dynamically hide a report column? RRS feed

  • Question

  • User-204006626 posted

    I have an SSRS web reportviewer, and I have a few columns that show drillthrough links. Depending on certain conditions that I can only know at runtime, I'd like to hide one of these drillthrough columns. I'm having a bugger of a time figuring out how to do this.

    Would love to be able to do something simple like this, in my codebehind: ReportViewer1.LocalReport.Columns("Timesheets").Visible = False

    Is there any property/accessor that will let me dynamically hide a reportviewer colum? Alternatively, I already have this in my column visibility properties, in the RDLC: =iif(Parameters!ShowLinks,false,true)  --  this is a broad brush thing we use to hide all these drillthrough columns, but when I try to modify that to use my new param "ShowTimesheetLinks", I get the strangest error ever: "An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] 'RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default.".

    Either, how can I hide the column from the codebehind, or how can I use my new Parameter so it doesn't give this strange error? I added the param to the RDLC and referenced it in the column visibility expression, as shown above.

    Thanks!

    Friday, August 12, 2011 12:43 PM

All replies

  • User-830595639 posted

    Hi,

    I think you are doing in the right way, because for making visibility true/false is only possible through expression. Please check the property of your new parameter, it should work. Just compare the previous and the new parameter property.

    I hope this will help you.

    Thanks

    Nishant

    Tuesday, August 16, 2011 3:54 AM
  • User567269486 posted

    I normally use something like this and it works CBool(IIf(Parameters!ShowLinks,False,True)).

    You could also use report parameters: set the value before binding the datasource to the report and use the parameter as a expression like this =Fields!Param1.Value

    Tuesday, August 16, 2011 7:54 AM