I have a problem with using textbox in c# (Visual Studio). When I'm writting this:
protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = gv.Rows[e.RowIndex];
TextBox serial = (TextBox)row.Cells[1].Controls[0];
TextBox name = (TextBox)(row.Cells[2].Controls[0]);
TextBox cost = (TextBox)(row.Cells[3].Controls[0]);
TextBox number = (TextBox)(row.Cells[4].Controls[0]);
string query = String.Format("UPDATE games SET name='{1}', cost={2}, number={4} WHERE serial={0}",
serial.Text, name.Text, cost.Text, number.Text);
SqlConnection connect = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(query, connect);
connect.Open();
cmd.ExecuteNonQuery();
connect.Close();
this.gv.EditIndex = -1;
BindTheGridView();
}
i get 4 errors like this one:
Error 1 'TextBox' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'TextBox' could be found (are you missing a using directive or an assembly reference?)
Can someone tell me why is this thing happening? tnx...