Click here to Skip to main content
15,881,732 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In First page i have label in that label record as follows

SQL
Label1      22 may 15
Label2      4  may 15
Label3      9  may 15

In second page in accordion control run mode as follows

SQL
Discount packages.

When user click discount packages record as follows
SQL
ADVANCED FIRE FIGHTING [AFF]          Dropdownlist1
MEDICAL FIRST AID [MFA]               Dropdownlist2
PROFICIENCY IN SURVIVAL [PSCRB]       Dropdownlist3

i want to display first page Labe11,Label2 and Label3 value in to the above Dropdownlist1,Dropdownlist2 and Dropdownlist3.

How to do in asp.net using c#.
Posted
Updated 22-Jul-15 4:57am
v3

In addition to Solution 1, another way of passing data between different pages is client-side Web Storage, the API introduced with HTML5 but later established as a separate W3 candidate recommendation standard:
http://www.w3.org/TR/webstorage[^],
https://en.wikipedia.org/wiki/Web_storage[^].

These days, it is implemented by all non-nonsense browsers. You want to use sessionStorage object rather than localStorage, to avoid permanent contamination of your browser data. Additionally, you may want to use JSON if you want to put some complex object under one key. This technique is fully explained and demonstrated in the section of my article JavaScript Calculator, Dynamic Strict Mode Switching and Web Storage.

—SA
 
Share this answer
 
Pages do not exist anymore in the web app. In other words, when someone types in the url the code for that page runs on your server and then sends html to the client and then disconnects. Then, clicking on page 2, the code for page 2 runs and same thing happens. If you want to pass data between pages you can put the value in the Session or pass through the QueryString or use a cookie or application cache or look it up in the db from each page.

Lots of options. Easiest might be QueryString.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Jul-15 16:23pm    
5ed. There is another (in a way, more universal) approach based on Web storage — please see Solution 2.
—SA
Use QueryString for sending data or information from one page to another. This is the StateManagement. We can store the data within the pages its self.

eg.
when you are going to another page by clicking on button
protected void btn_Click(object sender, EventArgs e)
{
Responce.Redirect("Page2.aspx?data="+ Label1.Text);
}

And On Page2 Load Event
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.QueryString["data"].ToString());
}
it will write this label text belongs to page 1 on second page.
 
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