Here is my code
protected void GridView1_DeletingRow(object sender, EventArgs e)
{
Functions con = new Functions();
SqlConnection con1 = con.get();
con1.Open();
TextBox1.Visible = true;
Button1.Visible = true;
string z = TextBox1.Text;
GridView1.EnableViewState = true;
string name = GridView1.SelectedRow.Cells[1].Text;
SqlCommand com3 = new SqlCommand("select id from products where product
= '" + name + "' ", con1);
SqlDataReader read1 = com3.ExecuteReader();
read1.Read();
string pro = read1["id"].ToString();
SqlCommand com = new SqlCommand("UPDATE CartItems SET quantity = '" + z
+ "' where productid = '" + pro + "' ", con1);
}
Error :
Line 92: string name = GridView1.SelectedRow.Cells[1].Text;
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
What is the error exactly? , and how can I fix it ?