Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 ASP.NET Javascript , +
In asp.net development,javascript how to achieve value-passing between different web pages.Thank you.
Posted 28-Aug-12 23:19pm
pucx1.2K
Edited 28-Aug-12 23:22pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
v2
Comments
pucx at 29-Aug-12 5:53am
   
I pass a lot of data,if use query strings,it maybe not good?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

hi use like this
 
<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>
 
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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 Andreas Gieriet 100
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,260


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100