This is a migrated thread and some comments may be shown as answers.

Hide columns at runtime

1 Answer 292 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 25 Oct 2012, 03:44 PM
Is it possible to customize an ASP.NET (C#) report to hide one or two columns at runtime depending on the presence of a column in the datasource, or any other way? Ideally we would pass in a DataTable to the report without certain columns, or use a flag to determine whether or not to show the column.

1 Answer, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 30 Oct 2012, 09:43 AM
Hi Ed,

You can use the NeedDataSource event handler and in it to define the columns and column groups programmatically. For more information please check the Programmatic Control of Reports help article. Additionally you can check this forum post, which has a snippet for creating those groups and columns with code. Also please have in mind that as a best practice it will be good for you to create some tables and Crosstabs with the designer and check out the designer.cs file of the report. Once you are comfortable with those objects you will be ready to programmatically control and tweak them.

Greetings,
IvanY
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
Ed
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Share this question
or