Find Gridview's rows count

3 posts, 0 answers
  1. Chirag
    Chirag avatar
    37 posts
    Member since:
    May 2011

    Posted 01 Feb 2012 Link to this post

    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. vk
    vk avatar
    46 posts
    Member since:
    Jul 2012

    Posted 01 Feb 2012 Link to this post

    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";
    }
  3. Chirag
    Chirag avatar
    37 posts
    Member since:
    May 2011

    Posted 02 Feb 2012 Link to this post

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