473,811 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pass array object of child window references from client side to server side

zybernau
35 New Member
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
Nov 1 '07 #1
18 3638
dmjpro
2,476 Top Contributor
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
Nov 1 '07 #2
zybernau
35 New Member
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("htmH dnChild");

...
<body onunload = "getChilds('htm HdnChild')">


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

function getChilds(HdnID )
{
//alert("in Get child");
var hdnCtrl = document.all(Hd nID);
alert(myChild.l ength);
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
Nov 1 '07 #3
zybernau
35 New Member
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
...
Expand|Select|Wrap|Line Numbers
  1. window.onload = setChilds("htmHdnChild");
...
[HTML]<body onunload = "getChilds('htm HdnChild')">[/HTML]


Expand|Select|Wrap|Line Numbers
  1. function setChilds(HdnID)
  2. {
  3. alert("in set child");
  4. var hdnCtrl = document.all(HdnID);
  5. if (hdnCtrl!=null)
  6. {
  7. myChild = hdnCtrl;
  8. alert(myChild.length);
  9. }
  10. }
  11.  
  12. function getChilds(HdnID)
  13. {
  14. //alert("in Get child");
  15. var hdnCtrl = document.all(HdnID);
  16. alert(myChild.length);
  17. hdnCtrl.value = myChild;
  18. alert(hdnCtrl);
  19. }
  20.  
while setting the array object for the hidden field, its not working for me is there there any other way
Nov 1 '07 #4
dmjpro
2,476 Top Contributor
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("htmH dnChild");

...
<body onunload = "getChilds('htm HdnChild')">


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

function getChilds(HdnID )
{
//alert("in Get child");
var hdnCtrl = document.all(Hd nID);
alert(myChild.l ength);
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
How can you assign an array to a hidden field?
It is not possible.
You can store the values in a hidden field something like this.

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" id = "hdnID">
  2.  
Expand|Select|Wrap|Line Numbers
  1. var hdn = document.getElementById('hdnID');
  2. var array_values = "";
  3. var separator = "/*the separator character so that it does not occur in your array values*/";
  4. var array_obj = /*this is your array object*/ ;
  5. for(var i = 0;i<array_obj.length-1;i++) array_values += array_obj[i] + separator;
  6. array_values += array_obj[i];
  7. /*now write a code for retrieving the values from your hidden field ...using String.split method*/
  8.  
Debasis
Nov 1 '07 #5
dmjpro
2,476 Top Contributor
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("htmH dnChild");

...
<body onunload = "getChilds('htm HdnChild')">


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

function getChilds(HdnID )
{
//alert("in Get child");
var hdnCtrl = document.all(Hd nID);
alert(myChild.l ength);
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
Don't do post double and try to use code tags before post.

debasis
Nov 1 '07 #6
zybernau
35 New Member
How can you assign an array to a hidden field?
It is not possible.
You can store the values in a hidden field something like this.

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" id = "hdnID">
  2.  
Expand|Select|Wrap|Line Numbers
  1. var hdn = document.getElementById('hdnID');
  2. var array_values = "";
  3. var separator = "/*the separator character so that it does not occur in your array values*/";
  4. var array_obj = /*this is your array object*/ ;
  5. for(var i = 0;i<array_obj.length-1;i++) array_values += array_obj[i] + separator;
  6. array_values += array_obj[i];
  7. /*now write a code for retrieving the values from your hidden field ...using String.split method*/
  8.  
Debasis


Thanks Debasis,

is there any replacement for the hidden field that can store array variable
in server
Nov 1 '07 #7
dmjpro
2,476 Top Contributor
Thanks Debasis,

is there any replacement for the hidden field that can store array variable
in server
hey are you looking for server side script ...?
but you have first send it to ..... server ............the n you can store it.
i think you can't directly send an array to server.

debasis
Nov 1 '07 #8
zybernau
35 New Member
hey are you looking for server side script ...?
but you have first send it to ..... server ............the n you can store it.
i think you can't directly send an array to server.

debasis
that is what i am asking man, what we will do for text, we will store in the a hidden field and read the same in the server side, store in a session variable and retrive the same in some where in other pages or the same postback page

here what i need to know is there any thing replacement for hidden field
to store array objects..


Thanks
Nov 1 '07 #9
acoder
16,027 Recognized Expert Moderator MVP
Threads merged. Please do not double post.
Nov 1 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

9
48973
by: Randell D. | last post by:
Folks, I'm working on a contact name/address database whereby a slimed down list is shown in the main window. When a record is selected, the complete record is displayed in a new window via a call to window.open As opposed to closing and re-opening new windows, I would prefer that when the user is finished reading the complete record, they can click a link whereby the main window is sent in to focus.
3
3758
by: Isabel | last post by:
How can you close all child browser windows that where open by a parent browser window? I have links on a parent (main) page that opens the child page as a separate browser. However, I need to be able to close all the opened child browser pages from the parent page. Thank you for your help, Isabel
2
6451
by: Augusto Cesar | last post by:
Hello people. How can I Pass ASP Array variable to Javascript; I´m to trying this: <script language="JavaScript"> var x = new Array(10);
3
1621
by: Chris | last post by:
I have a modal (yes it must be modal) web page. I do this by having an empty frame that points to my main page (so that I can repost without new popups) I have to pass data to the child page from the parent and the only way I can figure to do it by the url. Please correct me if I'm wrong on that. When the data get to my frame I then have to pass the data to my child form, again through the url (i think). The only way I found to do...
9
3929
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object', 'Scripting', 'Scripting.FileSystemObject', and a few others However, when I try to create the fso object I keep receiving an error. 'ActiveX component can't create object: 'Scripting.FileSystemObject'
10
2519
by: Sean Dockery | last post by:
I have the following HTML file that I've been using for testing... <html> <head> <script type="text/javascript"> <!-- function handleWindowLoad() { var items = ; for (var i = 0; i < 11; i++) { items = "item" + (i + 1);
2
3870
by: gialby | last post by:
Ciao i have this problem.... i have a main asp page with this code PARENT PAGE <script language="vbScript"> function ricerca() finestra=window.open("ricerca.asp","","width=500,height=500,top=0,left=0,resizable=yes,scrollbars=yes")
7
1992
by: multicherry | last post by:
Hi, Having searched for a way to fetch a window object by name, all I came across were answers along the line of... "All you have to do is say windowObj = window.open("blah", "name");" which isn't very useful if you want to fetch information from an existing document in the window. One solution I came up with was quite simple; open the "new" window, giving you a reference to the object, then use window.history.back() to
1
3173
by: John L. | last post by:
How do I invoke the scroll() method of a window object for a scrollable IFRAME element in an HTML document? I am using IE 7.0, and I thought the following would work: document.frame01.scroll(x,y) or possibly document.getElementById('frame01').scroll(x,y)
3
5459
Frinavale
by: Frinavale | last post by:
I've created a few ASP.NET Ajax Enable Server controls. There are 2 components to these controls: a server side Object that deals with the server side stuffs, and a client side Object that deals with the client side stuff. My controls are pretty nifty and quite useful but I keep coming back come back to the same question: How do I pass data from the JavaScript Object to the Server code? Up 'til now I've been using HiddenFields in...
0
9727
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.