如何使用c#将一个页面的标签值显示到另一个页面。 [英] how to display label value of one page to another page using c#.

查看:315
本文介绍了如何使用c#将一个页面的标签值显示到另一个页面。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在第一页中,我在该标签记录中有如下标签



In First page i have label in that label record as follows

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



手风琴控制运行模式的第二页如下




In second page in accordion control run mode as follows

Discount packages.



当用户点击折扣套餐记录如下


When user click discount packages record as follows

ADVANCED FIRE FIGHTING [AFF]          Dropdownlist1
MEDICAL FIRST AID [MFA]               Dropdownlist2
PROFICIENCY IN SURVIVAL [PSCRB]       Dropdownlist3



i希望在上面的Dropdownlist1,Dropdownlist2和Dropdownlist3中显示第一页Labe11,Label2和Label3值。



如何在asp.net中使用c#。


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#.

推荐答案

除了解决方案1之外,另一种在不同页面之间传递数据的方式是客户端 Web存储,引入了API使用HTML5但后来建立为单独的W3候选推荐标准:

http://www.w3.org / TR / webstorage [ ^ ],
https://en.wikipedia.org/wiki/Web_storage [ ^ ]。



现在,它由所有非废话浏览器实现。您希望使用 sessionStorage 对象而不是 localStorage ,以避免永久性污染您的浏览器数据。此外,如果要将一些复杂对象放在一个键下,则可能需要使用JSON。我的文章 JavaScript Calculator, Dynamic Strict一节中对此技术进行了充分说明和演示。模式切换和网络存储



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

网页应用中不再存在页面。换句话说,当有人在URL中键入时,该页面的代码在您的服务器上运行,然后将html发送到客户端,然后断开连接。然后,单击第2页,第2页的代码运行,同样的事情发生。如果要在页面之间传递数据,可以将值放在Session中,或者通过QueryString或使用cookie或应用程序缓存,或者从每个页面的数据库中查找。



很多选择。最简单的可能是QueryString。
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.


使用QueryString将数据或信息从一个页面发送到另一个页面。这是国家管理。我们可以将数据存储在自己的页面中。



例如。

当你通过点击按钮来访问另一页时/>
protected void btn_Click(object sender,EventArgs e)

{

Responce.Redirect(Page2.aspx?data =+ Label1.Text) ;

}



和On Page2加载事件

protected void Page_Load(object sender,EventArgs e)

{

Response.Write(Request.QueryString [data]。ToString());

}

它将在第二页上写下此标签文本属于第1页。
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.


这篇关于如何使用c#将一个页面的标签值显示到另一个页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆