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

Hide Telerik Table row

9 Answers 1022 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Manisha Shivjiani
Top achievements
Rank 1
Manisha Shivjiani asked on 03 Aug 2010, 05:05 PM
Hi,

I need help hiding a tablerow object conditionally from code behind.

I researched on the forums and knowledge base and could not find the answer.

I also looked at the article - http://www.telerik.com/help/reporting/faq-accessing-items.html
but it does not show how to get the tablerow object.

Following is my code.


private void detail_ItemDataBinding(object sender, EventArgs e)
{
    // Get the detail section object from sender
    Telerik.Reporting.Processing.DetailSection section = (Telerik.Reporting.Processing.DetailSection)sender;
    // From the section object get the current DataRow
    Telerik.Reporting.Processing.IDataObject dataObject = (Telerik.Reporting.Processing.IDataObject)section.DataObject;
    object rowdata = (object)section.DataObject.RawData;
    if ((dataObject["EEODStatement"] == null) || (dataObject["EEODStatement"].ToString().Length == 0))
    {
        Telerik.Reporting.Processing.Table table1 = (Telerik.Reporting.Processing.Table)section.ChildElements.Find("table1", true)[0];
        // Here I want to access a particular tablerow object and hide it
    }
}

9 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 06 Aug 2010, 02:10 PM
Hi Manisha Shivjiani,

The simplest way to hide certain rows from a table is to apply a filtering condition to that table. For example, to hide all table rows where the value of a given field is null or an empty string, you can use a filtering expression like the following one:

= Len(IsNull(Fields.MyField, "")) > 0

Please refer to the online documentation about the Filters property of the Table report item for more information. A good general explanation about filtering data can be found in the following help section: Filtering Data. Anyway, there is no need to write custom code in the ItemDataBinding event handler to accomplish this.

If the above explanation does not help you to resolve your problem, could you be so kind to elaborate what are trying to accomplish, so we can provide you more help.

All the best,
Ivan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Błażej
Top achievements
Rank 1
answered on 12 Sep 2011, 09:43 AM
Hi , I have a table in my report and I want to hide rows which haven't got any data (string ==null or string is empty).
So i tried to use this filter but i don't know what is the 'Fields.MyField' ? 
0
Steve
Telerik team
answered on 12 Sep 2011, 11:50 AM
Hi Błażej,

It is the field/column from your database with name MyField.

Kind regards,
Steve
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Błażej
Top achievements
Rank 1
answered on 13 Sep 2011, 09:15 AM
Hi,

when I add this filter to my table , in this case:  fields.myfield==null my all table disappear, I want only one row to be not visible.
Any sugestion ? 
0
Steve
Telerik team
answered on 13 Sep 2011, 01:13 PM
Hi Błażej,

This means that your column myfield has no null values and the result of the filter would always be false i.e. it would never show any data.

All the best,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Travis
Top achievements
Rank 1
answered on 23 Aug 2012, 02:18 PM
Is it possible to hide a footer row that I use for sub totals based on a certain condition?  I want to hide the sub total row when there is only one record in the group.
0
Robert
Top achievements
Rank 1
answered on 30 Aug 2013, 08:20 PM
I have a similar problem, but one that can't be solved by table filtering. (I think.)

My table has two rows inside the same group. The first row will always be display for each data item, but the second row should be visible or invisible based on the value of a field in the data item.

I can easily use conditional formatting to hide the text boxes in question, but I can't seem to get ride of the empty space left over.

I've tried handling ItemDataBound and setting the textbox height to 1px, but the empty space remains the same.

Thoughts?
0
Peter
Telerik team
answered on 03 Sep 2013, 03:21 PM
Hello Robert,

You should be able to conditionally control the row visibility. Our recommendation is to review the table groups with Group Explorer in extended mode and add the required filters to the to the second row group.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
Muhammad
Top achievements
Rank 1
answered on 23 Feb 2018, 05:33 AM
Hello Admin
If you're still active to reply on this post or if there is any other person willing to help me out or seeing this post please help me out with this. I applied this filtering on the field in the table and now I am getting result in 'True' / 'False' format. Like if the column contains NULL value it returns False and if the column contains any value it is returning True but the scenario was to hide the NULL row means it should be shifted up with the column that contains any value.


= Len(IsNull(Fields.MyField, "")) > 0
Tags
General Discussions
Asked by
Manisha Shivjiani
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Błażej
Top achievements
Rank 1
Steve
Telerik team
Travis
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Peter
Telerik team
Muhammad
Top achievements
Rank 1
Share this question
or