Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Lets say I have two pages, one page where user will choose unknown of students, each student has two properties string name and array grades. how can I pass the student data to another page all to together.
So If the user choose 3 students, the second page to get the students data. Each student and his grade.
Posted

1 solution

Exactly how you do that will depend on a huge variety of things, including how you actually store the information for all students, not just the three your user is interested in, but the basic mechanism is the same. There are three basic ways to do it:
1) Query string. URL's can contain additional information, to the right of a question mark: you've probably seen it loads of times with Google queries and so forth:
mydomain.com/mypage.apsx?key=value
You can use the same thing when you redirect them to the second page. The page then accesses the query string and finds the list of students.
2) Cookies. You can send the information to the client and it's stored on his computer. The second page then access the cookies during page Load and displays the student info.
3) Session. This is stored on the server and the second page accesses it directly to fetch the relevant students.

There are advantages and disadvantages to each, but you'll need one of them. Google can find you the exact way to use them if you just search quickly.

[edit]Typos[/edit]
 
Share this answer
 
v2
Comments
OriginalGriff 20-May-14 13:58pm    
That's not really relevant: the class instance will not really survive the page cycle. Where are you storing the student grades that you load into the class? Database?

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