21 Answers, 1 is accepted
Currently there is no way to hide table columns programmatically out of the box. You can modify the table definition with code, in order to remove the desired column from it, but it is not that simple. You see, the Table / Crosstab report item is not a mere grid of cells and has a very complex internal structure. The Report Designer does a great deal of work to simplify common tasks, such as removing a column from the table, but the underlying code is far from trivial to post it here. Could you, please, be more specific about what are you trying to accomplish? Perhaps there is a simple solution to your problem, that does not involve a lot of coding.
Sincerely yours,
Ivan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
May be I should start a new thread but I am the same request as John.
Depending of the user, I need the column 2 of my table to be hidden or removed (I don't have any problem with the column being removed.
I tried the following before binding the table but no success. Did you have implement something in the most recent version or may be is there a workoaround to do it.
public ListSIR(string workOrder, string div) |
{ |
/// <summary> |
/// Required for telerik Reporting designer support |
/// </summary> |
/// |
InitializeComponent(); |
//remove container column if mining |
if (div == "M") |
{ |
table1.ColumnGroups.Remove(table1.ColumnGroups[1]); |
table1.Body.Columns.Remove(table1.Body.Columns[1]); |
} |
OracleDataAdapter da = new OracleDataAdapter(getSQL(), ConfigurationManager.ConnectionStrings["OraCon"].ConnectionString); |
table1.DataSource = da; |
} |
thank you
Deleting a table column programmatically is not that simple. You need to remove the underlying report items of that column as well. Your best bet will be to create two versions of the same table in the report designer: one with and one without the column in question and compare the differences between them in the InitializeComponent method.
However there is a much simpler method to prevent a certain table column from appearing. If you apply a filter to a column group which always evaluates to false, that will prevent the corresponding table column from appearing. If the column group is static (i.e. it has no grouping criteria specified) you need to make it dynamic first (e.g. by specifying a grouping criteria which groups by a constant value). To illustrate this approach I have created a small sample report (please see the attached file) which allows you to show or hide table columns according to the values of report parameters. The sample uses only group filters - no additional coding is involved at all. You need the AdventureWorks sample database which comes with every installation of our product in order to run that report.
Best wishes,
Ivan
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
I tried using the sample, but when previewing the report I get the following error :
"An error has occured while processing Table 'productCrosstab':
Detail group found!"
What's wrong ?
Thanks !
Thanks for the hint on how to make some columns invisible.
I've got another issue - is it possible to reorder the columns in runtime? Depending on user settings, I'd like to swap the column groups, is that doable?
Thanks!
To achieve dynamical order of the Table item you have to create it programmatically. Check out the "Dynamic" Table in Telerik Reports forum thread where you can find a sample project that illustrates how to create a dynamic Table item. You will need the AdventureWorks sample database which comes with the installation of the product. Just change the connectionString accordingly and you should be able to run it.
Sincerely yours,Peter
the Telerik team
The post has helped me solve the issue of hiding the column. The problem now i am facing is that the column header does not appear in all the pages (eg not in all 2,3 or 4 pages). It appears only in the first page. I would like it appear in all page header. I had tryied draging tableheader to page header it did not work, I also tryied adding a table to pageHeader that also dint work(not able to add table to page header). Can you help me solving this issue. I am using Q3 2010 version of telerik reporting.
Regards,
Saravanan.R
The solution has helped me solve the issue. I have a small query in addition. Generally we have a ReportHeader( appears only on the first page of the report) and PageHeader(appears on all the pages generated). How can i do this? I want the company logo and other common fiels on pageheader and the filter that i have applied to get the required output of the report in the pageheader.
I had tryied to add an other pageheader in the designer.cs file dint work out. Can you help me out?
Regards,
Saravanan.R
To create the Header part(ReportHeader, PageHeader) do click out side the design part of the report. I had been trying to click on the header part and add an other Header part :).
Regards,
Saravanan.R
Fehler 17 "Telerik.Reporting.ReportParameter" enthält keine Definition für "UI", und es konnte keine Erweiterungsmethode "UI" gefunden werden, die ein erstes Argument vom Typ "Telerik.Reporting.ReportParameter" akzeptiert. (Fehlt eine Using-Direktive oder ein Assemblyverweis?) C:\Users\c095e021\Downloads\173754_reportlibrary\ReportLibrary\ReportLibrary\SampleReport.Designer.cs 252 30 ReportLibrary
I need to Hide some Columns in my Table...
The project provided in this thread is created with a version which is two years old now and the API has changed since. As the error correctly says you should delete the UI part of the code referencing the report parameters as it no longer exists. The change has been introduced in the Q1 2010 release, namely Telerik.Reporting.ReportParameter.UI property is now OBSOLETE. I've updated the project to use the current latest version and it works correctly.
All the best,
Steve
the Telerik team
Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!
I have a couple of questions regarding the posted sample:
1. Does this technique apply only to a crosstab type report? What about a table or a report that doesn't include a crosstab or table? (For example, the Invoice - SalesOrderDetails.cs report in the telerik samples that come with the demo).
2. When looking at the sample in the designer, I can't find where the group filters are that you have applied. I've attached a screenshot of what it looks like in my designer.
Use the group explorer (http://www.telerik.com/help/reporting/ui-group-explorer.html) in extended mode to view your group settings.
Cheers!
What I had to do is:
> Click on a cell
> Right-click to bring up the context menu
> Select Column Group or Row Group
> Select Group Properties
The terminology is a little confusing; I'm completely new to reporting and need to satisfy myself the difference between these groups and the (group explorer) groups.
Is there any way to achieve this? Either programatically or with the designer.
Thanks in advance.
Apply Docking (e.g. Fill for Ivan's example) for the Table item, so that it is bound to its container and keeps its size.
Kind regards,
Steve
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >