Click here to Skip to main content
15,917,928 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need to call another form from the current form.

The called form should be populated with the details of the records of the calling form with reference to the personnel_id on the calling form.

I tried this

C#
protected void Page_Load(object sender, EventArgs e)
{
    this.Form.Target = "_blank";
}

protected void Button1_Click(object sender, EventArgs e)
{

    Response.Redirect("Otherpage.aspx");
}


I pass on the personnel_id to the calling form, which should populate the called form with data from the database.


How do I accomplish this?

Any reference sites or examples will be welcomed.


Thanks

What I have tried:

reviewed my on works for similar examples, browse the internet.
Posted
Updated 25-Sep-16 22:22pm
v3
Comments
[no name] 23-Sep-16 13:07pm    
You use a querystring or session variable.

C#
protected void Button1_Click(object sender, EventArgs e)
{
    int id = 123; // this will come from data on this page
    Session["PersonnelID"] = id;
    Response.Redirect("Otherpage.aspx");
}


in otherpage.aspx

C#
protected void Page_Load(object sender, EventArgs e)
{
    int id = 0;
    if (Session["PersonnelID"] != null)
    {
        id = (int)Session["PersonnelID"];
        // you can also remove the data from the Session at this point if required
    }
}
 
Share this answer
 
Load of ways!
Query string: Request.QueryString Collection[^]
Cookies: ASP.NET Cookies Overview[^]
Session variables: ASP.NET Session State Overview[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900