Comment récupérer valeur cellule d'un gridview?
Bonjour,
ceci est une question simple, mais je n'arrive pàlus à retrouver comment faire pour les gridview, je le fais avec les datagrid pourtant
j'ai vu ceci sur msdn:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| if(e.CommandName=="Select")
{
// Convert the row index stored in the CommandArgument
// property to an Integer.
int index = Convert.ToInt32(e.CommandArgument);
// Get the last name of the selected author from the appropriate
// cell in the GridView control.
GridViewRow selectedRow = CustomersGridView.Rows[index];
TableCell contactName = selectedRow.Cells[1];
string contact = contactName.Text;
// Display the selected author.
Message.Text = "You selected " + contact + ".";
} |
alors je fais ceci:
Code:
string monstring = GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[1].ToString();
mais cela ne fonctionne pas il me renvoie ceci:
Citation:
System.Web.UI.WebControls.DataControlFieldCell
:marteau: pouvez vous m'indiquer la bonne syntaxe??