如何在页面加载中将页面1的会话中的存储值获取到页面2 [英] how to get the stored values in session of page1 to the page 2 in page load

查看:84
本文介绍了如何在页面加载中将页面1的会话中的存储值获取到页面2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里在第1页我需要输入员工的详细信息并输入详细信息,这些应该存储在会话中,在第2页中,我输入的详细信息应该在会话的帮助下显示,之后我需要提交toproceed。如何在页面加载中编写会话代码

here in page 1 i need to enter the details of employee and entering the details these should be stored in a session and in page2 the details what i have entered should display with help of session and later i need to submit how toproceed. how to write the code for session in page load

推荐答案

// suppose u want to store data table in session .
session["sessionName"]=dt;// your table .
protected void Page_Load(object sender, EventArgs e)
   {
// now u want to access that session here(on other page )
      if(session["sessionName"]!=null)
{
  DataTable dt=new DataTable();
dt=session["sessionName"] as DataTable;
}

}



我希望这会对你有帮助。


I hope this will help u.


当然你将得到空字段因为页面回发所以在字段中输入记录之后你应该在你已经做过的会话中存储记录(我认为)。在第二页你按会话获得第一页值(我已经告诉过)那个会话你应该当你点击prev按钮时用于绑定第一页控件。
of course u will get empty fields cause page is post back so after entering record in fields u should store records in session that u already doing (i think) .on second page u r getting first page value by session(that i already told ) that session u should use for binding the first page controls when u click on prev button .


你不应该使用这些会话。这不是编码标准的正确方法。发给我第一页代码。
u should not use these much of session .this is not right way of coding standard . send me first page code also .


这篇关于如何在页面加载中将页面1的会话中的存储值获取到页面2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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