如何使用C#代码在Asp.net中传递Datail [英] How to pass datails in Asp.net using c# code
本文介绍了如何使用C#代码在Asp.net中传递Datail的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< b>/b我在将datail从一页传递到另一页时遇到问题,请让我知道此
<b></b> i have problem with passing datails from one page to another page please let me know solution for this
推荐答案
的解决方案,有很多方法可以做到:
1.在重定向到特定页面之前,您可以使用传递所需信息作为参数来构造URL.
例如:
字符串pageURL =〜/NewPage.aspx?DisplayMode =" + Server.UrlEncode("Edit")+
& Param1 =" + Server.UrlEncode(paramValue)+
& Param2 =" + Server.UrlEncode(paramValue);
Response.Redirect(pageURL,false);
2.如果数据是批量的,则可以使用Session变量将数据存储在第一页中,并可以在第二页中进行获取.
例如:
//在第1页中
Session ["Page1Data"] =字符串数据;
//在第2页中
字符串strTemp = Session ["Page1Data"]
There are many ways to do that:
1. You can construct URL with required info passing as parameters before redirecting to specific page.
Ex:
string pageURL = "~/NewPage.aspx?DisplayMode=" + Server.UrlEncode("Edit") +
"&Param1=" + Server.UrlEncode(paramValue) +
"&Param2=" + Server.UrlEncode(paramValue);
Response.Redirect(pageURL , false);
2. If data is in bulk, you can use Session variable to store data in first page and can fetch in second page.
Ex:
//in page 1
Session["Page1Data"] = string data;
//in page 2
string strTemp = Session["Page1Data"]
尝试此链接
将数据从一个地方传递到另一个地方 [
try this Link
Passing Data From one place to another [^]
这篇关于如何使用C#代码在Asp.net中传递Datail的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文