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 3638
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("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
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('htm HdnChild')">[/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("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. -
<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("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
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 ............the n 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 ............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
acoder 16,027
Recognized Expert Moderator MVP
Threads merged. Please do not double post.
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 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.
|
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
|
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 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...
|
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'
| |
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);
|
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")
|
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
|
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)
|
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...
|
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...
| |
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,...
|
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
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...
| |