Rajiv
Rajiv

Reputation: 685

Transfer data to another ASP.net page

I have an ASP.net Web Application containing 2 pages, viz; default.aspx (form to capture user data and insert into the database) and confirmation.aspx (To print the receipt for the data inserted). This is a Booking App. The User enters data in default.aspx and the data is stored in a database using the default.aspx. I have managed to capture the identity record id after inserting the record. I would like to:

a. Transfer this unique Identity ID (stored in a variable var id) to Confirmation.aspx only on a successful data insert b. Capture the ID in confirmation.aspx c. Execute a SQL Query to fetch the record and display it in a GRID View. This is basically a receipt that would be printed for the user

Could you please suggest on using: a. Use session state. b. Create public properties in the source page and access the property values in the target page.

I am a beginner in ASP.net.... Thanks in advance

Upvotes: 0

Views: 739

Answers (2)

Rajiv
Rajiv

Reputation: 685

I did something like this:

Default.aspx: Response.Redirect("confirmation.aspx?ID=" + id);

Confirmation.aspx:

        string id = null;
        id = Request["ID"].ToString();
        Response.Write("This is the Confirmation Page" + id);

Upvotes: 2

Related Questions