void ShowRecipe() { SqlDataAdapter sda = new SqlDataAdapter("Select * from Recipes", con); DataTable dt = new DataTable(); sda.Fill(dt); GridViewU_R.DataSource = dt; GridViewU_R.DataBind(); }
protected void GridViewU_R_RowEditing(object sender, GridViewEditEventArgs e) { GridViewU_R.EditIndex = e.NewEditIndex; int index = e.NewEditIndex; GridViewRow row = (GridViewRow)GridViewU_R.Rows[index]; Label recipeID = (Label)row.FindControl("LabelId"); RId = int.Parse(recipeID.Text.ToString()); SqlDataAdapter sda = new SqlDataAdapter("Select * from Recipes where Id='" + RId + "'", con); DataTable dt = new DataTable(); sda.Fill(dt); GridViewU_R.DataSource = dt; GridViewU_R.DataBind(); }