protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) { formatsDS = (DataSet)Cache["Formats"]; int selectedIndex = e.RowIndex; int formatId = (int)Session["FormatID"]; DataRow row = formatsDS.Tables["Formats"].Rows.Find(formatId); row[1] = ((TextBox)formatsGridView.Rows[e.RowIndex].Cells[1].Controls[0]).Text; if (row[1].ToString().Length != 0) { if (!decksService.formatAlreadyExists(formatId, row[1].ToString())) { decksService.UpdateTableRow(formatId, row[1].ToString()); formatsGridView.EditIndex = -1; formatsGridView.DataSource = formatsDS; formatsGridView.DataBind(); } else { Response.Write("<script>alert('name already taken');</script>"); } } else { Response.Write("<script>alert('name can't be empty');</script>"); } }
protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) { DataSet formatsDS = (DataSet)Cache["Formats"]; int selectedIndex = e.RowIndex; string temp = formatsGrid.Rows[selectedIndex].Cells[0].Text; int formatId = int.Parse(temp); DataRow row = formatsDS.Tables["Formats"].Rows.Find(formatId); row[1] = ((TextBox)formatsGrid.Rows[e.RowIndex].Cells[1].Controls[0]).Text; if (!decksService.formatAlreadyExists(formatId, row[1].ToString())) { decksService.UpdateTableRow(formatId, row[1].ToString()); } else { Response.Write("<script>alert('name already taken');</script>"); } formatsGrid.EditIndex = -1; formatsGrid.DataSource = formatsDS; formatsGrid.DataBind(); }