dario1133 Posted November 12, 2015 at 06:34 PM Report Share #589628 Posted November 12, 2015 at 06:34 PM Vivam, Tenho uma gridview cuja primeira coluna é constituída por checkbox. Pretendo passar cada linha dessa coluna para um array que guarde o valor 0 e 1 da checbox, para depois introduzir na base de dados. Actualmente não consigo nem ler o valor de cada checbox. int[] x = new int[GridView_roles.Rows.Count]; for (int i = 0; i < GridView_roles.Rows.Count; i++) { x[i] = Convert.ToInt32(GridView_roles.Rows[i].Cells[0]); Response.Write(x[i]); } Link to comment Share on other sites More sharing options...
apocsantos Posted November 13, 2015 at 02:56 PM Report Share #589660 Posted November 13, 2015 at 02:56 PM Boa tarde, Algo tipo isto: int valor=0; foreach (DataGridViewRow linha in GridView_roles.Rows) { if (linha.Cells[0].value = true) { valor = 1; } else { valor = 0; } } Cordiais cumprimentos, Apocsantos "A paciência é uma das coisas que se aprendeu na era do 48k" O respeito é como a escrita de código, uma vez perdido, dificilmente se retoma o habito" Link to comment Share on other sites More sharing options...
dario1133 Posted November 13, 2015 at 03:17 PM Author Report Share #589664 Posted November 13, 2015 at 03:17 PM Obrigado. Mas não consigo utilizar o 'value'. Aparece sublinhado a vermelho, com a mensagem "....Are you missing a using directive or an assembly reference?" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now