使用javascript将asp.net网页值传递到另一个页面的问题 [英] problem in passing asp.net web page values to another page using javascript

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

问题描述

我在使用javascript将default1.aspx页面值传递到default2.aspx页面时遇到问题。我试图做的是当用户点击提交按钮时,确认显示你想输入详细信息点击确定所有输入的值都使用javascript传递给default2.aspx我所做的如下:

 function confirm1(){
if (confirm('' 你确定吗?')){
window.open(' Default2.aspx'' mywin'' height = 400px width = 500px locatio = no titlebar = 0');
}



并点击我的按钮:

 ScriptManager.RegisterClientScriptBlock(this.Page,this。 GetType(),popup,alert('Empid:'+@ E_ID+isssss'...');,true); 



使用这个只弹出一个msgbox并点击ok new default2.aspx appers但是为空。如何解决这个问题?

简而言之,我想使用javascript函数将所有值从default1.aspx传递到default2.aspx。

解决方案

使用查询字符串传递值[ ^ ]。试试这个:

  function  confirm1(){
// 从表单中获取值并将其存储在变量中。
var ID = document .getElementById(' YourID').value;
var 名称= 文档 .getElementById(' YourName')。value;

if (确认(' 你确定吗?')){
window .open('' Default2.aspx?ID =' + ID + ' & ; Name =' + Name,' mywin'' height = 400px width = 500px locatio = no titlebar = 0');
}
}



在Default2.aspx页面中检索它。请看到这个 [ ^ ]。





--Amit


好吧,上面建议的方法非常好。此外,您可以在加密后通过查询字符串传递值。



 字符串 temp =加密(Textbox1.Text);  //  文本使用任何加密算法 
Response.Redirect( Webform2.aspx?Value = + temp);





要在另一端检索价值,



< pre lang =c#> if (Request.QueryString [ ]!= null
{
txtBox1.Text = Decrypt( Request.QueryString [ Value]。ToString());
}





您可以参考以下链接进行加密解密



使用C#加密和解密数据 [ ^ ]



以下链接将解释很多传递值。



如何:在ASP.NET网页之间传递值 [ ^ ]



问候.. :)


i m facing problem in passing default1.aspx page values to default2.aspx page using javascript. what i m trying to do is when user clicks on submit button a confirmation appears that 'do u want to enter details' on clicking ok all the entered values passes to default2.aspx using javascript what i have done is as follows:

function confirm1() {
    if (confirm('Are u sure??')) {
        window.open('Default2.aspx', 'mywin', 'height=400px width=500px locatio=no titlebar=0');
    }


and on my button click:

ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "popup", "alert('Empid:'" + "@E_ID" + "is inssss'...');", true);


using this only popup a msgbox and on clicking ok new default2.aspx appers but empty . How to resolve the problem?
In short i want to pass all values from default1.aspx to default2.aspx using javascript function.

解决方案

Pass the values using querystring[^]. Try this:

function confirm1() {
    //Get the value from form and store it in variables.
    var ID = document.getElementById('YourID').value;
    var Name = document.getElementById('YourName').value;

    if (confirm('Are u sure??')) {
        window.open('Default2.aspx?ID='+ID+'&Name='+Name, 'mywin', 'height=400px width=500px locatio=no titlebar=0');
    }
}


Retrive it in Default2.aspx page. Please see this[^].


--Amit


Well,approach suggested above is pretty well.Further,you can pass values through query string after encryption.

String temp = Encrypt (Textbox1.Text);//Text gets encrypted using any algorithm
Response.Redirect("Webform2.aspx?Value=" +temp);



To retrieve values on another end,

if(Request.QueryString["Value"] != null)
{
txtBox1.Text = Decrypt(Request.QueryString["Value"].ToString());
}



You can refer to below link for Encryption decryption

Encrypt and Decrypt Data with C#[^]

Below link will explain alot about passing values.

How to: Pass Values Between ASP.NET Web Pages[^]

Regards..:)


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

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