Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In asp.net development,javascript how to achieve value-passing between different web pages.Thank you.
Posted
Updated 28-Aug-12 22:22pm
v2

I am not sure if i understood your question correctly.
Assuming that you want to pass values from one page to another, you can go for query strings.
You may find the below article helpful
Passing variables between pages using QueryString[^]

Get query string values in JavaScript[^]

More links here[^]
 
Share this answer
 
v2
Comments
pucx 29-Aug-12 5:53am    
I pass a lot of data,if use query strings,it maybe not good?
hi use like this

XML
<form name="myform" method="post" action="post.aspx">
<input name="user" value="peter"/>
<input value="cc" value="aus"/>
<a href="javascript:myform.submit()">Click</a>
<form>


C#
function postwith (to,p) {
  var myForm = document.createElement("form");
  myForm.method="post" ;
  myForm.action = to ;
  for (var k in p) {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  }
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;
}



More Info:

http://mentaljetsam.wordpress.com/2008/06/02/using-javascript-to-post-data-between-pages/[^]

regards
sarva
 
Share this answer
 
Through Javascript you will not be able to pass values between pages. You need some objects to store the values which can be shareable throughout the pages.

In this case you can use QueryString to pass the values between the pages and you can retrieve it using javascript.

Otherwise you can use various objects to pass the values from one page to another.


--Amit
 
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