本文介绍了将子窗口引用的数组对象从客户端传递到服务器端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这是我的场景

i我在javascript中有一个包含数据的数组变量。

同时刷新或回发这些变量丢失了,我无法在刷新/回发后获得变量中的那些数据


请告诉我如何将这些变量存储回服务器之前重新打包并带回来



注意:我使用asp.net作为服务器端

谢谢,


Raj

解决方案



你可以用Cookie做到......但问题是你不能在Cookie中存储数组.....你有将它存储为字符串


Debasis Jana




hi,

here is my scenario
i am having a array variable in javascript which contains data.
while refreshing or postback these varibles got lost and i did''nt able to get those data in the variables after a refresh/postback

please give me idea how to store back these variable to server before rereshing and taking them back on load


note: i am using asp.net as server side
Thanks,

Raj

解决方案

you can do it using Cookie ...... but the problem is you can''t store Array in Cookie ..... you have to store it as String

Debasis Jana



Thanks JANA ,

but what i am trying is
while onload and onunload the array array object is stored in hdnfield
and on load, its got restored in the javascript
...
window.onload = setChilds("htmHdnChild");

...
<body onunload = "getChilds(''htmHdnChild'')">


function setChilds(HdnID)
{
alert("in set child");
var hdnCtrl = document.all(HdnID);
if (hdnCtrl!=null)
{
myChild = hdnCtrl;
alert(myChild.length);
}
}

function getChilds(HdnID)
{
//alert("in Get child");
var hdnCtrl = document.all(HdnID);
alert(myChild.length);
hdnCtrl.value = myChild;
alert(hdnCtrl);
}

while setting the array object for the hidden field, its not working for me is there there any other way

Thanks



这篇关于将子窗口引用的数组对象从客户端传递到服务器端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:00