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

only have 2 rows in radgrid

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amanda
Top achievements
Rank 2
Amanda asked on 23 Mar 2009, 04:38 PM
Is there a way that I can tell the grid to only show the first 2 rows and none of the others, ever?  Or is this something where I can only do it if the datasource has the 2 rows and that's it?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Mar 2009, 05:32 AM
Hello Amanda,

To display only two rows in the grid and hide the others you can try out the following code:

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem dataItem in RadGrid1.Items) 
        { 
            if (dataItem.ItemIndex > 1) 
            { 
                dataItem.Visible = false
            } 
        }  
    } 

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