hiding columns in a report viewer
-
i am building a report.rdlc and using the report viewer and i wanted to know how can i hide or unhide columns in my report is this possible? can anyone assist me? oh p.s. using c# but it doesn't matter if u know how to do it in vb will jus convert it kenny
-
i am building a report.rdlc and using the report viewer and i wanted to know how can i hide or unhide columns in my report is this possible? can anyone assist me? oh p.s. using c# but it doesn't matter if u know how to do it in vb will jus convert it kenny
-
oh.. I have faced the same problem too. But i convert the report to excel and do the work what i required to fulfill only my output. If u get the some solution please share it
yes i found a solution what u do is this step 1 create a dataset with a table that has all the possible columns that you might use in your report step 2 add all of these columns to your report step 3 create report parameters for all the columns u want to hide / un-hide step 4 assign the value of the hidden property for each column to evaluate whether or not to set hidden property to true or false example set hidden property to
=iif(Parameters!param_TicketId.Value="T",True,False)
step 5 assign values to the report parameters wherever you are going to build and run the reportReportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc"); ReportDataSource rds = new ReportDataSource(); rds.Name = "spTroubleTicket_AllTableAdapter"; rds.Value = dsReport.Tables[0]; ReportViewer1.LocalReport.DataSources.Add(rds); ReportParameter[] param = new ReportParameter[2]; param[0] = new ReportParameter("param_TicketId", "F"); param[1] = new ReportParameter("param_TimeRecieved", "T"); ReportViewer1.LocalReport.SetParameters(param); ReportViewer1.LocalReport.Refresh();
you can do any manipulation you want based on the code above my original code i allowed my users to select the column the wanted to be in the report. and i also allowed them to generate the dataset based on the specific search criteria they chose to use and use this as the dataset. so in essence i create a data table with all possible columns and added it to my report and then allowed user to hide and unhide columns and generate there dataset to be used on the report dynamically Kenny Edmond -
oh.. I have faced the same problem too. But i convert the report to excel and do the work what i required to fulfill only my output. If u get the some solution please share it
p.s if u have any other problem just drop a message here will reply as soon as i see it
-
i am building a report.rdlc and using the report viewer and i wanted to know how can i hide or unhide columns in my report is this possible? can anyone assist me? oh p.s. using c# but it doesn't matter if u know how to do it in vb will jus convert it kenny
Left mouse click on the column (make sure you are not clicking on header or data cell, you have to click on the column itself (above the header)) that you would like to enable/hide and right mouse click and click on Properties (or hit F4). You will see TableColumn properties. You will have there Visibility property with + sign on the left. Click on + sign and expand Visibility. You will have there Hidden property. You can put your custom code to to view or hide your column. For instance =IIF(Fields!LeadNext.Value = 4, TRUE, FALSE).
Vlad Bezden