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

[Solved] Display blank if same values are repeated in rows for a column

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Telerikuser
Top achievements
Rank 1
Telerikuser asked on 16 Jun 2009, 04:51 PM
How would I display blank/no value if same values are repeated in rows for a column.

For instance if I have a grid with below values

John 200
John 400
John 350
Peter 200
Peter 350
Gary 100
John 400

I would like to display like
John 200
        400
        350
Peter 200
         350
Gary 100
John 400

Thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Jun 2009, 05:00 AM
Hi,

You can try out the following code to remove repeated text from cells of a column:
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["FirstName"].Text == nextRow["FirstName"].Text) 
                { 
                    nextRow["FirstName"].Text=""
                }  
        } 
    } 

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