//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; MeasuringUnit mu = measuringUnitsList.ElementAt(rowIndex); rowIndex %= gvMeasuringUnits.PageSize; if (!mu.IsValid) { mu.IsValid = true; SQLProcedures.EnableDisableMeasuringUnit(mu); gvMeasuringUnits.Rows[rowIndex].FindControl("btnUredi").Visible = true; gvMeasuringUnits.Rows[rowIndex].FindControl("btnOnemoguci").Visible = true; gvMeasuringUnits.Rows[rowIndex].FindControl("btnOmoguci").Visible = false; } } else { throw new Exception(); } }