简体   繁体   中英

How to get count of visible rows in Grid View?

I Have GridView with both visible and invisible rows in it,

But i just want count of only visible Rows in that grid

i have tried this

int rowCount = gv_SPAvailable.Rows.Count(row => row.IsVisible); 

But i could not get, is there any other way, any one please help

尝试这个:

int rowCount = gv_SPAvailable.Rows.GetRowCount(DataGridViewElementStates.Visible);

Also these code is working fine

     int numVisible = 0; 
        foreach(GridViewRow row in gv_SPAvailable.Rows) 
        { 
            if(row.Visible == true) 
            { 
                numVisible += 1; 
            } 
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM