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

[Solved] Hide repeat data

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 20 Nov 2009, 02:14 AM
I am trying to hide the tablecell data for a column if it has the same DataKeyValue as the row
above.  Does anyone know if this is possible?  Thanks in advance.

Column 1        Column 2
xxxxxxxxxx        xxxxxxxxxxx
Blank              xxxxxxxxxxx

Blank Column 1, 2nd row value because both rows have the same datakeyvalue.

Joshua

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Nov 2009, 09:21 AM
Hi Joshua,

Check out the following code and see if it helps meet your requirement:
c#:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    {          
            for (int rowIndex = RadGrid1.Items.Count - 2; rowIndex >= 0; rowIndex--)  
            {  
                GridDataItem row = RadGrid1.Items[rowIndex];  
                GridDataItem nextRow = RadGrid1.Items[rowIndex + 1]; 
 
                if (row.GetDataKeyValue("DataKeyNameField").ToString() == nextRow.GetDataKeyValue("DataKeyNameField").ToString())  
                    { 
                        nextRow["Column1UniqueName"].Text = ""
                    }  
            }  
    } 

Thanks
Princy.
Tags
Grid
Asked by
Josh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or