public void Guardar(object sender, EventArgs e)//Guardar { DataTable dt = Session["Tabla"] as DataTable; if (dt.Rows.Count == 0) { string script = @"<script type='text/javascript'> alert('La tabla no continiene ningun items'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } else { try { var registrosactas_baja = Controlasql.CcreaActabaja(txtN_acta.Value, txtfecha.Value, Selectubicacion.Value, Selectarea.Value, Session["USUARIO"].ToString(), Session["BD"].ToString()); if (registrosactas_baja > 0) { foreach (GridViewRow row in GridViewdetalle.Rows) { string serialtemp = row.Cells[1].Text; string detallemant = row.Cells[2].Text.Trim(); string destino = row.Cells[3].Text; string test = serialtemp; string[] palabras = test.Split('/'); string serial = palabras[0]; string nombrearticulo = palabras[1]; try { var registros3 = Controlasql.CcreabajaArticulo(txtfecha.Value, serial, detallemant, destino, Session["USUARIO"].ToString(), txtN_acta.Value, Session["BD"].ToString()); string script = @"<script type='text/javascript'> alert('Acta OK'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } catch (Exception Ex) { throw Ex; } } //aqui creamos el acta de mantenimiento } } catch (Exception ex) { throw ex; } } }