[Solved] save data from 2 forms and show it in a 3rd form c# [closed]


From your original posted code all i see that you are doing is populating a grid in both page1 and page2 and redirecting the row selection to the menu2 page. I did not see where you were populating the “sessioncontrol” so that is probably null and cannot be cast to string. Also, doing empty try catch is bad coding practice. You should do the following instead:

lblNombreUsuario.Text = (string)Session["sesionicontrol"];
if (!IsPostBack)
{
    //prueba 
    if (Request.QueryString.Count > 0)
    {
        if Request.QueryString["rut"] != null)
        {
            txtRutEncuestador.Text = Request.QueryString["rut"].ToString();
            leerNombre();
        }

        if (Request.QueryString["cod_sap"] != null)
        {
            txtIdEstudio.Text = Request.QueryString["cod_sap"].ToString();
            leerEstudios();
        }
    } 
}

If you want to have both in one page, you will need a query that ruturns both and then on selection do: (Using sudo code here)

Request.Redirect("~/Menu2.aspx?rut=" + rut + "&code_sap=" + codeSap);

3

solved save data from 2 forms and show it in a 3rd form c# [closed]