//enables usage of data in the selected row protected void btnOmoguci_Click(object sender, EventArgs e) { Button btn = sender as Button; int rowIndex = 0; if (int.TryParse((string)btn.CommandArgument, out rowIndex)) { rowIndex -= 1; Meal m = mealsList.ElementAt(rowIndex); rowIndex %= gvMeals.PageSize; if (!m.IsValid) { m.IsValid = true; SQLProcedures.EnableDisableMeal(m); gvMeals.Rows[rowIndex].FindControl("btnUredi").Visible = true; gvMeals.Rows[rowIndex].FindControl("btnOnemoguci").Visible = true; gvMeals.Rows[rowIndex].FindControl("btnOmoguci").Visible = false; } } else { throw new Exception(); } }