Hide Telerik Table row

10 posts, 0 answers
  1. Manisha Shivjiani
    Manisha Shivjiani avatar
    24 posts
    Member since:
    Nov 2009

    Posted 03 Aug 2010 Link to this post

    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
        }
    }
  2. Ivan
    Admin
    Ivan avatar
    114 posts

    Posted 06 Aug 2010 Link to this post

    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
  3. Błażej
    Błażej avatar
    11 posts
    Member since:
    Jun 2011

    Posted 12 Sep 2011 Link to this post

    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' ? 
  4. Steve
    Admin
    Steve avatar
    10940 posts

    Posted 12 Sep 2011 Link to this post

    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 >>

  5. Błażej
    Błażej avatar
    11 posts
    Member since:
    Jun 2011

    Posted 13 Sep 2011 Link to this post

    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 ? 
  6. Steve
    Admin
    Steve avatar
    10940 posts

    Posted 13 Sep 2011 Link to this post

    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 >>

  7. Travis
    Travis avatar
    226 posts
    Member since:
    Jan 2003

    Posted 23 Aug 2012 Link to this post

    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.
  8. Robert
    Robert avatar
    23 posts
    Member since:
    Feb 2009

    Posted 30 Aug 2013 Link to this post

    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?
  9. Peter
    Admin
    Peter avatar
    1671 posts

    Posted 03 Sep 2013 Link to this post

    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.

  10. Muhammad
    Muhammad avatar
    27 posts
    Member since:
    Oct 2017

    Posted 22 Feb 2018 Link to this post

    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
Back to Top