Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass value to a page 2

Status
Not open for further replies.

kurie

Programmer
Jun 4, 2008
170
ZA
hie guys
in a windows applications we pass a value from form2 to form1 by using this form1.textbox1.text = "text" from form2.
What is the corresponding command on an asp page
 
assuming that you mean form1 = page1 and form2 = page2.
place a link or Redirect command on page1 and pass the parameter in the query string

on page1
<asp:Hyperlink ... navigateurl="page2.aspx?id=1" />

on page2 code behind
int id = int.Parse(QueryString["id"]);

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Hie all
@Jmeckley: thank you very much
Look at what im doing
Session["LocName"] = tvwLocations.SelectedNode.Text;
//tboLocation.Text = (string)Session["LocName"]
Session["LocID"] = Convert.ToUInt64(tvwLocations.SelectedNode.Value);

Response.Redirect("frmsite.aspx");
but this Response.Redirect is refreshing every button on my page, it seems as if withh you methosd i still have to use it to open the pages, isnt there a way to do it without refreshing the whole page.

 
No, because ASP.NET only knows about one page at a time.

Chip H.


____________________________________________________________________
www.chipholland.com
 
that is the nature of web development.
a user requests a uri
request is sent to server
server processes request
server sends response
client renders response

if you want to do this without a full page rewrite you will need to use an ajax request. the stack above is the same. the only difference is how the client sends and receives the response.

also you don't need session for this. just pass the parameter as a querystring. depending on session too much is like having lots of global variables. it's very easy to overwrite data, or get false positive values from session because a value wasn't removed after it's scope.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top