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
18 3581
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
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
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");
...
[HTML]<body onunload = "getChilds('htmHdnChild')">[/HTML] - 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 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
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. -
<input type="hidden" id = "hdnID">
-
-
var hdn = document.getElementById('hdnID');
-
var array_values = "";
-
var separator = "/*the separator character so that it does not occur in your array values*/";
-
var array_obj = /*this is your array object*/ ;
-
for(var i = 0;i<array_obj.length-1;i++) array_values += array_obj[i] + separator;
-
array_values += array_obj[i];
-
/*now write a code for retrieving the values from your hidden field ...using String.split method*/
-
Debasis
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
Don't do post double and try to use code tags before post.
debasis
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. -
<input type="hidden" id = "hdnID">
-
-
var hdn = document.getElementById('hdnID');
-
var array_values = "";
-
var separator = "/*the separator character so that it does not occur in your array values*/";
-
var array_obj = /*this is your array object*/ ;
-
for(var i = 0;i<array_obj.length-1;i++) array_values += array_obj[i] + separator;
-
array_values += array_obj[i];
-
/*now write a code for retrieving the values from your hidden field ...using String.split method*/
-
Debasis
Thanks Debasis,
is there any replacement for the hidden field that can store array variable
in server
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 ............then you can store it.
i think you can't directly send an array to server.
debasis
hey are you looking for server side script ...?
but you have first send it to ..... server ............then 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
Threads merged. Please do not double post.
Dear All,
i am having a parent window
say parent.aspx
here i am creating child windows in javascript
like this -
var myChild = new Array();
-
-
function MenuPopUp(url,width,height,left,top)
-
{
-
if (width == 0)//code to close all the open windows
-
{
-
-
var len=0;
-
for (i=0; i<myChild.length; i++)
-
{
-
if (myChild[i].closed == false)
-
len = len+1;
-
//alert(myChild[i])
-
}
-
//alert(len);
-
-
if (len >0) {
-
-
if (len == 1)
-
{
-
alert(" Switch from Company - Closing the open Window ") ;
-
}
-
else
-
{
-
alert(" Switch from Company - Closing all "+ len +" open Windows ") ;
-
}
-
-
for (i=0; i<len; i++)
-
{
-
if (myChild[i].closed == false)
-
myChild[i].close();
-
}
-
}
-
relocate(url,"s_company_name");
-
-
}
-
else// code open newe window and assign to the array
-
{
-
var Children ;
-
Children = myChild.length;
-
//alert(Children);
-
myChild[Children] = window.open(url,"","width=" + width +",height=" + height +",top=" + top + ",left=" + left + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no");
-
}
-
}
-
this function will open a new window in else part and closes the existing windows in the if part
and for each window i am opening i am referencing/assigning it[window] to a array object
so while doing some action in the main page , i need to close the child windows , so i can directly close by looping though the array and close the windows.
but in my main page [parent] page i have implemented a page refreshing logic
according to this the page will refresh after 500 secs
so in this following scenario the certain open windows become orphan
1) opening 2 new windows at 10th sec
2) wait until the page refreshes [say 500]
3) after 500 sec open another window
4) now do the task where you need to close all the child windows
5) the already opened 2 windows left open as orphans
this is why because while refreshing the javascript variable [myChild] is being reset and all the values contained in the variable is destroyed.
the windows opened will have no reference
Question:
so now i need to pass this array object to server[on unload event] and save the object in the session variable and retrive and restoring it to the array variable while the page loads again
so i may be having reference to all the child windows opened..
please give me solution
Thanks,
Raj
gits 5,390
Expert Mod 4TB
hi ...
i think that will not work the way you think, i'm quite sure that you cannot store window-references at the server since that are client-side objects ... but you have other possibilities:
1. instead of refreshing the entire page you may use an ajax-call and update only the relevant parts of your page
2. use a frameset with a frame for your main page and one with 0px height and width, where you may store your references during the app-runtime
kind regards
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
...
[snip]
while setting the array object for the hidden field, its not working for me is there there any other way
Use the Array object's join() method.
hi ...
i think that will not work the way you think, i'm quite sure that you cannot store window-references at the server since that are client-side objects ... but you have other possibilities:
1. instead of refreshing the entire page you may use an ajax-call and update only the relevant parts of your page
2. use a frameset with a frame for your main page and one with 0px height and width, where you may store your references during the app-runtime
kind regards
Thanks gits,
so there is no way for passing the array objects from client side to server side
Use the Array object's join() method.
please see this link ...
Since the threads are dealing with the same problem, I've merged the threads.
Thanks gits,
so there is no way for passing the array objects from client side to server side
Normal arrays with simple data such as numbers and strings, yes, but references to child windows, no.
Why not use Ajax, frames or iframes as gits has suggested?
Normal arrays with simple data such as numbers and strings, yes, but references to child windows, no.
Why not use Ajax, frames or iframes as gits has suggested?
Thanks moderator
i don't know ajax or sorta please refer me some posts, so that i can start with .. Thanks
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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);
|
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...
|
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',...
|
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++)...
|
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()
...
|
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...
|
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:
...
|
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...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |