Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to display in page2.aspx
id=1 and name=xyz
from page1.aspx
Posted

Hi, You can pass the id and name inside query string to page2.aspx like

Inside your page1.aspx on a button click

Response.Redirect("~/page2.aspx?id="+ yourId +"&name="+ yourName;

Then in page2.aspx you fetch them
int id = int.Parse(Request.QueryString("id").ToString());
     string name = Request.QueryString("name").ToString(); 


You can also use Session depending upon your requirement.
 
Share this answer
 
Comments
Tarun Mangukiya 23-Jun-11 3:23am    
Absolutely Right.
Well, there can be various ways to use other page value on current one. But the way you ask and the question sounds, it looks like the homework statement wanted you to know about QueryString.

For details of how to pass and use query strings, look here:
Passing variables between pages using QueryString[^]
Another link describing the same[^]
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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