Hello guys. For the past two days I have been trying to research
how in 05 can you pull the value from a gridview's cell. The various
methods that I have found on the web all seem to not work such as:
GridView1.Rows[e.RowIndex].Cells[3].Text
This comes up as an empty string. The old way of doing things was
this in a datagrid:
e.Item.Cells[2].Controls[0])).Text
This stuff is for a C# method of updating the gridview. Everyone has suggested
using the control's built in features, but you know what??
I DO NOT WANT TO. lol. If you can help it will be much appreciated.
I am trying to set parameters to pass into a stored procedure.
ex:
VB Code:
  1. sqlconn = new SqlConnection();
  2.             sqlconn.ConnectionString = ConfigurationManager.AppSettings["cs"];
  3.             insertWO = new SqlCommand("usp_Update_WORK_ITEMS", sqlconn);
  4.             insertWO.CommandType = CommandType.StoredProcedure;
  5.             insertWO.Parameters.Add("@WORK_DESC", SqlDbType.VarChar).Value = this.GridView1.Rows[e.RowIndex].Cells[3].Text;
  6.             insertWO.Parameters.Add("@CRS_WO_ID", SqlDbType.Int).Value =  Convert.ToInt32(this.GridView1.Rows[e.RowIndex].Cells[5].Text);
  7.             insertWO.Parameters.Add("@STATUS_ID", SqlDbType.Int).Value = Convert.ToInt32(this.GridView1.Rows[e.RowIndex].Cells[4].Text);
  8.             //insertWO.Parameters.Add("@TIME_SPENT", SqlDbType.DateTime).Value = Convert.ToDateTime(this.txtTimeSpent.Text.ToString());
  9.             insertWO.Parameters.Add("@COMPLETE_DT", SqlDbType.DateTime).Value = Convert.ToDateTime(this.GridView1.Rows[e.RowIndex].Cells[7].Text);
  10.             insertWO.Parameters.Add("@START_DT", SqlDbType.DateTime).Value = Convert.ToDateTime(this.GridView1.Rows[e.RowIndex].Cells[8].Text);
  11.             insertWO.Parameters.Add("@ID", SqlDbType.Int).Value = Convert.ToInt32(this.GridView1.Rows[e.RowIndex].Cells[2].Text);
  12.             sqlconn.Open();
  13.             insertWO.ExecuteNonQuery();

This is returning an empty string except for the keyed field.

Thanks guys!!
Pol