Good, I would like you to help me I have a GridView
like this:
When I select in Ver
it shows me a popup or a pop-up window like this:
The point is that when I click on Guardar
if it is recorded correctly and a message is sent, it was registered correctly like this:
And when it closes it shows again the GridView
but in the field where it says validated it has to say YES and the gridview is not updated.
This is the code I use to record:
protected void BtnnoConforme_Click(object sender, EventArgs e)
{
DateTime d1 = DateTime.Parse(TextBox11.Text);
string mes = d1.ToString("MM");
string anio = d1.ToString("yyyy");
DateTime d3 = DateTime.Parse(TextBox5.Text);
string FechaPagoMes = d3.ToString("MM");
string FechaPagoAnio = d3.ToString("yyyy");
if (mes != FechaPagoMes)
{
Label1.Text = "El Mes y año de la Fecha de Vencimiento de Recibo tiene que ser igual al Mes y Año de Fecha de Cumplimiento : " + TextBox11.Text;
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (anio != FechaPagoAnio)
{
Label1.Text = "El Mes y año de la Fecha de Vencimiento de Recibo tiene que ser igual al Mes y Año de Fecha de Cumplimiento : " + TextBox11.Text;
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (mes != FechaPagoMes)
{
Label1.Text = "El Mes de Pago tiene que ser del Mismo Mes Actual";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (anio != FechaPagoAnio)
{
Label1.Text = "El Año Tiene que ser igual al Año de Actual";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox4.Text == "")
{
Label1.Text = "Ingresa Su Fecha de Emision";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (DateTime.Parse(TextBox4.Text) > DateTime.Parse(TextBox5.Text))
{
Label1.Text = "La Fecha de Emision tiene que ser Menor a la Fecha Vencimiento";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox4.Text == "")
{
Label1.Text = "Ingresa Su Fecha de Emision";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox6.Text == "")
{
Label1.Text = "Ingrese el Monto";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox6.Text == "0.0")
{
Label1.Text = "El monto debe ser mayor de 0";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox6.Text == "0")
{
Label1.Text = "El monto debe ser mayor de 0";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox4.Text == "")
{
Label1.Text = "Ingresa Su Fecha de Emision";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox6.Text == "..")
{
Label1.Text = "Ingresa Su Fecha de Emision";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else if (TextBox11.Text == "")
{
Label1.Text = "Ingresa Su Fecha de Emision";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
}
else
{
string fileName = FileUpload1.PostedFile.FileName;
int fileLength = FileUpload1.PostedFile.ContentLength;
byte[] imageBytes = new byte[fileLength];
FileUpload1.PostedFile.InputStream.Read(imageBytes, 0, fileLength);
SqlConnection cn = new SqlConnection(ObtenerCadenaConexion());
SqlCommand cmd = new SqlCommand("sp_atendertarea", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@idregistrotarea", SqlDbType.Int);
cmd.Parameters.Add("@usuario", SqlDbType.VarChar);
cmd.Parameters.Add("@fechaemision", SqlDbType.Date);
cmd.Parameters.Add("@fechacumplimiento", SqlDbType.Date);
cmd.Parameters.Add("@fechaatendido", SqlDbType.Date);
cmd.Parameters.Add("@montopagado", SqlDbType.Decimal, 18);
cmd.Parameters.Add("@numerorecibo", SqlDbType.VarChar);
cmd.Parameters.Add("@tarea", SqlDbType.VarChar);
cmd.Parameters.Add("@oficina", SqlDbType.VarChar);
cmd.Parameters.Add("@fechaemisions", SqlDbType.Date);
cmd.Parameters.Add("@comentario", SqlDbType.VarChar);
cmd.Parameters.Add("@fechacumplimientotarea", SqlDbType.Date);
cmd.Parameters.Add("@fileName", SqlDbType.VarChar, 50);
cmd.Parameters.Add("@fileContent", SqlDbType.Image);
cmd.Parameters.Add("@active", SqlDbType.Bit);
cmd.Parameters.Add("@ERROR", SqlDbType.Char, 500);
cmd.Parameters.Add("@registro", SqlDbType.Int);
cmd.Parameters["@idregistrotarea"].Value = lblidregistrotareas.Text;
cmd.Parameters["@usuario"].Value = TextBox3.Text;
cmd.Parameters["@fechaemision"].Value = TextBox4.Text;
cmd.Parameters["@fechacumplimiento"].Value = TextBox5.Text;
cmd.Parameters["@fechaatendido"].Value = DBNull.Value;
cmd.Parameters["@montopagado"].Value = TextBox6.Text;
cmd.Parameters["@numerorecibo"].Value = TextBox7.Text;
cmd.Parameters["@tarea"].Value = TextBox2.Text;
cmd.Parameters["@oficina"].Value = TextBox10.Text;
cmd.Parameters["@fechaemisions"].Value = TextBox4.Text;
cmd.Parameters["@comentario"].Value = "";
cmd.Parameters["@fechacumplimientotarea"].Value = TextBox11.Text;
cmd.Parameters["@fileName"].Value = fileName;
cmd.Parameters["@fileContent"].Value = imageBytes;
cmd.Parameters["@active"].Value = true;
cmd.Parameters["@registro"].Value = true;
cmd.Parameters["@ERROR"].Direction = ParameterDirection.Output;
cn.Open();
BtnnoConforme.Enabled = false;
cmd.ExecuteNonQuery();
message = (string)cmd.Parameters["@ERROR"].Value;
Label1.Text = message;
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal1();", true);
/*INICIO */
if (!Page.IsPostBack)
{
SqlConnection con = new SqlConnection(ObtenerCadenaConexion());
con.Open();
SqlCommand cmd1 = new SqlCommand("SP_SeguimientoTareaMaster", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("OPT", 1);
cmd.Parameters.Add(p1);
SqlDataAdapter da = new SqlDataAdapter(cmd1);
DataTable dt = new DataTable();
da.Fill(dt);
DtgSolicitudes.DataSource = dt;
DtgSolicitudes.Visible = true;
DtgSolicitudes.DataBind();
if (DtgSolicitudes.Rows.Count != 0)
{
DtgSolicitudes.HeaderRow.Cells[1].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[2].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[3].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[4].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[5].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[6].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[7].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[8].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[9].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[10].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[11].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[12].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[13].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[14].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.Cells[15].Attributes["data-hide"] = "phone";
DtgSolicitudes.HeaderRow.TableSection = TableRowSection.TableHeader;
con.Close();
}
}
/* FIN */
cn.Close();
TextBox6.Text = "";
}
}
If you could help me.