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

Find Gridview's rows count

2 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chirag
Top achievements
Rank 1
Chirag asked on 01 Feb 2012, 12:55 PM
hi to all 

i want to run loop on gridview's rows 
my code is 

IList<GridViewRow> GridRowsList  = Radgvcustom.ChildrenOfType<GridViewRow>();
foreach (GridViewRow gvr in GridRowsList)
{
              **************
              **
              **
              **
              **************
}

here a one thing is notice by me "GridRowsList" count is changed depends on gridview's height 
Gridview's  Item source  has 40 items 
but in above code return me a different different values like (21,25,30)

Thur loop i want to get some of the values from text-box, Combo box, Check box and list box. which is included in every gridview's row 

2 Answers, 1 is accepted

Sort by
0
vk
Top achievements
Rank 1
answered on 01 Feb 2012, 01:52 PM
If you set the EnableRowVirtualization property of your gridview to false, you will get the actual row count, but the perfomance may be very poor. So depending on your task I would choose another way of iterating through records...

foreach (var row in customersGridView.Items)
{
     Customer cust = row as Customer;
     cust.Title = "Some title";
}
0
Chirag
Top achievements
Rank 1
answered on 02 Feb 2012, 07:06 AM
hi  Valentin K.
thanks for replay 
but 
i want to find out controls from grid and get the value because i have no any property for binding with control i wan to store all value in string array
Tags
GridView
Asked by
Chirag
Top achievements
Rank 1
Answers by
vk
Top achievements
Rank 1
Chirag
Top achievements
Rank 1
Share this question
or