I’m workingin Visual Studio 2008, C# framework 3.5, I have 3 forms,
in form1 and form2 I read some data (contains in a gridview in each form) and pass it to
form3, but when I try to save data (in form3)I just get the data from form1 or form2, but
not both
I THINK THE PROBLEM IS IN THE LOAD PAGE, thanks in advance, here is my code:
//form3:
public partial class menu2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lblNombreUsuario.Text = (string)Session["sesionicontrol"];
//prueba
if (Request.QueryString.Count > 0)
{
try
{
txtRutEncuestador.Text = Request.QueryString["rut"].ToString();
leerNombre();
}
catch { };
}
if (!IsPostBack)
{
if (Request.QueryString.Count > 0)
{
try
{
txtIdEstudio.Text = Request.QueryString["cod_sap"].ToString();
leerEstudios();
}
catch { };
}
}
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:
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)