IList pimList = gv_PisInfo.DataController.GetAllFilteredAndSortedRows(); //ListpimList = gc_PisInfo.DataSource as List ; if (pimList == null) return; foreach (PisInfoModel item in pimList) { string ip = item.Ip; bool pingResult = Ping(ip); if (pingResult) { item.Communications = 1; } else { item.Communications = 0; } }