DataGrid遍历
1 foreach (DataGridItem item in dgdData.Items) 2 { 3 if (item.ItemType.Equals(ListItemType.Item)) 4 { 5 try 6 { 7 ((TextBox)item.Controls[0]).ReadOnly = true; 8 } 9 catch 10 { 11 12 } 13 } 14 }
1 foreach (DataGridItem item in dgdData.Items) 2 { 3 if (item.ItemType.Equals(ListItemType.Item)) 4 { 5 try 6 { 7 ((TextBox)item.Controls[0]).ReadOnly = true; 8 } 9 catch 10 { 11 12 } 13 } 14 }