473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ASP.NET maintain state with client side JavaScript...?

Howdy all

Hopefully I can explain my problem straightforwardly.

In it's simplest explanation, what I want to do is have a hyperlink that,
when clicked, executes some client side JavaScript and then saves every form
element value and reloads the page (with the 'save' being much the same as
what is achieved by an AutoPostBack="True" attribute on a web/html control).

Actually it doesn't matter which order the JavaScript or 'save' executes in
if that helps.

FYI, the JavaScript hyperlink opens a new window. The new window performs
functionality relevant to the window that opened it, and when finished, I
need the window that opened it to refresh to show the new data, but I don't
want it to lose any values that may have been entered in form elements by
the user.

Maybe the solution is for the hyperlink to open the new window and then
perform a (.NET) postback (in order to save the form element values) in the
background... Is this possible or feasible?

Or can the hyperlink do a postback, then somehow popup the window...

Or can the popup window cause the window that opened it to do a postback via
window-to-window JavaScript (the main question I have though with this
option is will it just post the form back and not execute any button
actions?).

FYI, the main window has some buttons on it, however I don't want any of
their functions executed when the popup is opened, I just want the element
states maintained.

Maybe I should just play, it seems like the solution could more complicated
than what I might find through trial and error though, and I was hoping that
one of you might know the best solution.

Anyway, thanks for any help.
Cheers
Matt
Nov 19 '05 #1
4 4557
Well, you can simply have an asp:linkbutton which you attach an OnClick
event

myLink.Attributes.Add("onClick", "OpenWindowAndDoSomething();");

this will fire the OpenWindowAndDoSomething(); javascript method, and then
cause a postback

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:OO**************@TK2MSFTNGP15.phx.gbl...
Howdy all

Hopefully I can explain my problem straightforwardly.

In it's simplest explanation, what I want to do is have a hyperlink that,
when clicked, executes some client side JavaScript and then saves every
form
element value and reloads the page (with the 'save' being much the same as
what is achieved by an AutoPostBack="True" attribute on a web/html
control).

Actually it doesn't matter which order the JavaScript or 'save' executes
in
if that helps.

FYI, the JavaScript hyperlink opens a new window. The new window performs
functionality relevant to the window that opened it, and when finished, I
need the window that opened it to refresh to show the new data, but I
don't
want it to lose any values that may have been entered in form elements by
the user.

Maybe the solution is for the hyperlink to open the new window and then
perform a (.NET) postback (in order to save the form element values) in
the
background... Is this possible or feasible?

Or can the hyperlink do a postback, then somehow popup the window...

Or can the popup window cause the window that opened it to do a postback
via
window-to-window JavaScript (the main question I have though with this
option is will it just post the form back and not execute any button
actions?).

FYI, the main window has some buttons on it, however I don't want any of
their functions executed when the popup is opened, I just want the element
states maintained.

Maybe I should just play, it seems like the solution could more
complicated
than what I might find through trial and error though, and I was hoping
that
one of you might know the best solution.

Anyway, thanks for any help.
Cheers
Matt

Nov 19 '05 #2
Excellent thanks Karl!

Only problem I now face is that when the popup window is finished with and
is closed via JavaScript (which also calls the reload method of the page
that opened the popup), I get the common alert that you get when you try to
refresh a posted page:
"The page cannot be refreshed without sending the information. Click Retry
to send the information again, or click Cancel to return to the page you
were trying to view."

Obviously not ideal. I know this is not a JavaScript forum, don't suppose
you have any ideas re this issue?

Thanks a lot
Cheers
Matt

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eS**************@TK2MSFTNGP11.phx.gbl...
Well, you can simply have an asp:linkbutton which you attach an OnClick
event

myLink.Attributes.Add("onClick", "OpenWindowAndDoSomething();");

this will fire the OpenWindowAndDoSomething(); javascript method, and then
cause a postback

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:OO**************@TK2MSFTNGP15.phx.gbl...
Howdy all

Hopefully I can explain my problem straightforwardly.

In it's simplest explanation, what I want to do is have a hyperlink that,
when clicked, executes some client side JavaScript and then saves every
form
element value and reloads the page (with the 'save' being much the same
as
what is achieved by an AutoPostBack="True" attribute on a web/html
control).

Actually it doesn't matter which order the JavaScript or 'save' executes
in
if that helps.

FYI, the JavaScript hyperlink opens a new window. The new window performs
functionality relevant to the window that opened it, and when finished, I
need the window that opened it to refresh to show the new data, but I
don't
want it to lose any values that may have been entered in form elements by
the user.

Maybe the solution is for the hyperlink to open the new window and then
perform a (.NET) postback (in order to save the form element values) in
the
background... Is this possible or feasible?

Or can the hyperlink do a postback, then somehow popup the window...

Or can the popup window cause the window that opened it to do a postback
via
window-to-window JavaScript (the main question I have though with this
option is will it just post the form back and not execute any button
actions?).

FYI, the main window has some buttons on it, however I don't want any of
their functions executed when the popup is opened, I just want the
element
states maintained.

Maybe I should just play, it seems like the solution could more
complicated
than what I might find through trial and error though, and I was hoping
that
one of you might know the best solution.

Anyway, thanks for any help.
Cheers
Matt


Nov 19 '05 #3
Hmm, I've used window.opener.location.href instead of window.opener.reload()
and it's solved the situation.
I'd better put no-cache settings on the page then I think...

While I'm here, what is the combination of ASP.NET C# lines of code for
no-cache/pragma settings...?

Cheers
Matt

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:OO**************@TK2MSFTNGP14.phx.gbl...
Excellent thanks Karl!

Only problem I now face is that when the popup window is finished with and
is closed via JavaScript (which also calls the reload method of the page
that opened the popup), I get the common alert that you get when you try
to refresh a posted page:
"The page cannot be refreshed without sending the information. Click Retry
to send the information again, or click Cancel to return to the page you
were trying to view."

Obviously not ideal. I know this is not a JavaScript forum, don't suppose
you have any ideas re this issue?

Thanks a lot
Cheers
Matt

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eS**************@TK2MSFTNGP11.phx.gbl...
Well, you can simply have an asp:linkbutton which you attach an OnClick
event

myLink.Attributes.Add("onClick", "OpenWindowAndDoSomething();");

this will fire the OpenWindowAndDoSomething(); javascript method, and
then cause a postback

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:OO**************@TK2MSFTNGP15.phx.gbl...
Howdy all

Hopefully I can explain my problem straightforwardly.

In it's simplest explanation, what I want to do is have a hyperlink
that,
when clicked, executes some client side JavaScript and then saves every
form
element value and reloads the page (with the 'save' being much the same
as
what is achieved by an AutoPostBack="True" attribute on a web/html
control).

Actually it doesn't matter which order the JavaScript or 'save' executes
in
if that helps.

FYI, the JavaScript hyperlink opens a new window. The new window
performs
functionality relevant to the window that opened it, and when finished,
I
need the window that opened it to refresh to show the new data, but I
don't
want it to lose any values that may have been entered in form elements
by
the user.

Maybe the solution is for the hyperlink to open the new window and then
perform a (.NET) postback (in order to save the form element values) in
the
background... Is this possible or feasible?

Or can the hyperlink do a postback, then somehow popup the window...

Or can the popup window cause the window that opened it to do a postback
via
window-to-window JavaScript (the main question I have though with this
option is will it just post the form back and not execute any button
actions?).

FYI, the main window has some buttons on it, however I don't want any of
their functions executed when the popup is opened, I just want the
element
states maintained.

Maybe I should just play, it seems like the solution could more
complicated
than what I might find through trial and error though, and I was hoping
that
one of you might know the best solution.

Anyway, thanks for any help.
Cheers
Matt



Nov 19 '05 #4
http://www.15seconds.com/issue/010202.htm

Might have been written in classic-ASP days, but it still works for me... :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:ui**************@TK2MSFTNGP15.phx.gbl...
Hmm, I've used window.opener.location.href instead of
window.opener.reload() and it's solved the situation.
I'd better put no-cache settings on the page then I think...

While I'm here, what is the combination of ASP.NET C# lines of code for
no-cache/pragma settings...?

Cheers
Matt

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:OO**************@TK2MSFTNGP14.phx.gbl...
Excellent thanks Karl!

Only problem I now face is that when the popup window is finished with
and is closed via JavaScript (which also calls the reload method of the
page that opened the popup), I get the common alert that you get when you
try to refresh a posted page:
"The page cannot be refreshed without sending the information. Click
Retry to send the information again, or click Cancel to return to the
page you were trying to view."

Obviously not ideal. I know this is not a JavaScript forum, don't suppose
you have any ideas re this issue?

Thanks a lot
Cheers
Matt

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eS**************@TK2MSFTNGP11.phx.gbl...
Well, you can simply have an asp:linkbutton which you attach an OnClick
event

myLink.Attributes.Add("onClick", "OpenWindowAndDoSomething();");

this will fire the OpenWindowAndDoSomething(); javascript method, and
then cause a postback

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:OO**************@TK2MSFTNGP15.phx.gbl...
Howdy all

Hopefully I can explain my problem straightforwardly.

In it's simplest explanation, what I want to do is have a hyperlink
that,
when clicked, executes some client side JavaScript and then saves every
form
element value and reloads the page (with the 'save' being much the same
as
what is achieved by an AutoPostBack="True" attribute on a web/html
control).

Actually it doesn't matter which order the JavaScript or 'save'
executes in
if that helps.

FYI, the JavaScript hyperlink opens a new window. The new window
performs
functionality relevant to the window that opened it, and when finished,
I
need the window that opened it to refresh to show the new data, but I
don't
want it to lose any values that may have been entered in form elements
by
the user.

Maybe the solution is for the hyperlink to open the new window and then
perform a (.NET) postback (in order to save the form element values) in
the
background... Is this possible or feasible?

Or can the hyperlink do a postback, then somehow popup the window...

Or can the popup window cause the window that opened it to do a
postback via
window-to-window JavaScript (the main question I have though with this
option is will it just post the form back and not execute any button
actions?).

FYI, the main window has some buttons on it, however I don't want any
of
their functions executed when the popup is opened, I just want the
element
states maintained.

Maybe I should just play, it seems like the solution could more
complicated
than what I might find through trial and error though, and I was hoping
that
one of you might know the best solution.

Anyway, thanks for any help.
Cheers
Matt



Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Z. Majeed | last post by:
I have a static html page with a form. Is there a way to maintain the state of the form without using client-side scripting (no Javascript) or turning it into a dynamically-generated page using...
2
by: George | last post by:
Hi, I have a usercontrol which handles the menu functions which is included in the main form.My requirement is to pass a variable to the server and maintain its state when I click an item in the...
5
by: Dominic | last post by:
My question is about how to maintain view state in mobile ASP.NET across postback / request in a web farm environment. First of all, let's assume the web-farm does NOT use stick-session feature....
4
by: Carlos | last post by:
Hi all, I have an asp .net page that has a calculation in the middle of the page. My problem is that when the user hits the button to calculate, the page jumps to the top of the page whenever it...
7
by: Andrew Robinson | last post by:
I have a treeview control that I use as a menu & navigation control within a master page. The nodes for this control are loaded from a database which contains the text and url of each like and the...
0
by: just.an.imbecile | last post by:
Hello all, Here is a quick version of my problem. I have a website that consists of 4 ASPX pages. Every field is required by default, but on pages 1 and 2, there are several fields that can be...
5
by: Jeff | last post by:
Hello, I'd like to adapt some Greasemonkey scripts that I've written and have them applied to html files on the server side before the files are sent to users. I'm only looking at adapting...
1
by: zwieback89 | last post by:
Hi, I have a org tree with hierarchical display of employees built using classic asp and vbscript. I also have list of radio buttons for report names. I have 1 select box with dates in it....
11
by: Joseph Geretz | last post by:
I've been looking at two approaches for the maintenance of Session state for a Web Service application. One approach uses the old familiar Session object which I've used in the past for Web...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
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 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.