使用javascript将值从一页传递到另一页 [英] Pass value from one page to another using javascript

查看:120
本文介绍了使用javascript将值从一页传递到另一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的asp.net Web应用程序中有两个页面,如Parent.aspx和Child.aspx.从parent.aspx获得的值需要传递给页面后面的child.aspx代码.

I have two pages as Parent.aspx and Child.aspx in my asp.net web application. The values obtained from parent.aspx need to pass to child.aspx code behind page.

从父级到子级的重定向是通过javascript进行的.父页面包含empId,该文件需要传递到文件后面的子页面代码,因为相同的ID可用于获取员工的详细信息,例如姓名,年龄,PIN,银行帐户详细信息等.

The redirect from parent to child happens through javascript. Parent page contains empId which needs to be passed to child page code behind file as the same ID could be used to fetch the details of the employee such as name, age, PIN, bank account details etc.

该怎么做?

谢谢!

推荐答案

查看 ASP.NET QueryString用法或ASP.NET查询字符串访问上的任何其他资源.下面是一个完整的示例.

Check out ASP.NET QueryString Usage or any other resources on ASP.NET Query String access. A full example follows.

在客户端:

window.open ("http://www.yourwebsite.com?empid=somethin&PIN=somethinglese","mywindow");

在服务器端(在后面的代码中):

On the server side (in code behind):

string empid;
string PIN;

if(Request.QueryString.Count != 0)
{
    empid = Request.QueryString["empid"];
    PIN = Request.QueryString["PIN"];
}

这篇关于使用javascript将值从一页传递到另一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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