473,408 Members | 2,888 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,408 software developers and data experts.

Message back from JavaScript

I am trying to set up a Javascript popup box that has a way of sending back
a message to asp.net on how to process some data.

At the moment I am just doing:

myNextButton.Attributes.Add("onclick", "return confirm('Are you sure you
want finish this test?');")

to attach a popup box to a button. The problem is that the buttons only say
OK and Cancel. OK will take me to the event tied to the button and Cancel,
in effect, says to do nothing and act as if the User never pressed the
button.

What I am trying to do is have something different on the button, such as
Proceed or Go Back and someway to tell asp.net on the postback which button
was pushed.

The problem is that if you press the button, the event that is tied to the
onClick button will fire, and will do any normal processing. I want it to
process based on which buttons were pushed. Is there a way to send a
message to the event telling it what was done?

Thanks,

Tom
Nov 19 '05 #1
6 1904
Not sure to follow. I would just have two distinct buttons on my ASP.NET
Page each with its own click event handler server side. You can always ask
confirmation client side as you do now when one of these buttons is
pressed...

You could also create your won dialog if you prefer (but users would have to
press one button, then choos another button plus perhaps a cancel button in
this dialog). I would just put two buttons on the source page.

Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:%2***************@TK2MSFTNGP10.phx.gbl...
I am trying to set up a Javascript popup box that has a way of sending back a message to asp.net on how to process some data.

At the moment I am just doing:

myNextButton.Attributes.Add("onclick", "return confirm('Are you sure you want finish this test?');")

to attach a popup box to a button. The problem is that the buttons only say OK and Cancel. OK will take me to the event tied to the button and Cancel, in effect, says to do nothing and act as if the User never pressed the
button.

What I am trying to do is have something different on the button, such as
Proceed or Go Back and someway to tell asp.net on the postback which button was pushed.

The problem is that if you press the button, the event that is tied to the
onClick button will fire, and will do any normal processing. I want it to
process based on which buttons were pushed. Is there a way to send a
message to the event telling it what was done?

Thanks,

Tom

Nov 19 '05 #2
"Patrice" <no****@nowhere.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
Not sure to follow. I would just have two distinct buttons on my ASP.NET
Page each with its own click event handler server side. You can always ask
confirmation client side as you do now when one of these buttons is
pressed...

You could also create your won dialog if you prefer (but users would have
to
press one button, then choos another button plus perhaps a cancel button
in
this dialog). I would just put two buttons on the source page.
No, the problem is that I want to put up a warning popup window, which I am
doing now to alert the user that there is a problem and then be able to
handle the event based on which buttons he pushes. With the Confirm popup,
you only get to go on as normal or do nothing. You also can't change the
text on the buttons (I don't think).

I need to allow the user to something akin to a message box that passes back
a message that tells me what was pushed and then pass that message back to
the onClick event of the button.

Thanks,

Tom
Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:%2***************@TK2MSFTNGP10.phx.gbl...
I am trying to set up a Javascript popup box that has a way of sending

back
a message to asp.net on how to process some data.

At the moment I am just doing:

myNextButton.Attributes.Add("onclick", "return confirm('Are you sure

you
want finish this test?');")

to attach a popup box to a button. The problem is that the buttons only

say
OK and Cancel. OK will take me to the event tied to the button and

Cancel,
in effect, says to do nothing and act as if the User never pressed the
button.

What I am trying to do is have something different on the button, such as
Proceed or Go Back and someway to tell asp.net on the postback which

button
was pushed.

The problem is that if you press the button, the event that is tied to
the
onClick button will fire, and will do any normal processing. I want it
to
process based on which buttons were pushed. Is there a way to send a
message to the event telling it what was done?

Thanks,

Tom


Nov 19 '05 #3
Humm.. Sorry but still don't really understanding. So :
- you have a button. The users click on it.
- you want then to display a dialog box with two buttons A & B. If the user
choose A you have a postback and an action, if the user choose B you have
also some action to perform.
- for some reason you can have directly both A & B buttons on the source
page (perhaps you don't know you'll have them bas this is base on some
server side condition)

You could then :
- the user presses the button
- you open your own dialog with those two buttons (suing
window.showModalDialog), you return (window.returnValue) which button was
pressed
- here based on this return value, you could call the click event of either
the hidden "A" or the hidden "B" button.
- server side this will be seen as a click that is handled either by the A
event handler or the B event handler

Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
Not sure to follow. I would just have two distinct buttons on my ASP.NET
Page each with its own click event handler server side. You can always ask confirmation client side as you do now when one of these buttons is
pressed...

You could also create your won dialog if you prefer (but users would have to
press one button, then choos another button plus perhaps a cancel button
in
this dialog). I would just put two buttons on the source page.
No, the problem is that I want to put up a warning popup window, which I

am doing now to alert the user that there is a problem and then be able to
handle the event based on which buttons he pushes. With the Confirm popup, you only get to go on as normal or do nothing. You also can't change the
text on the buttons (I don't think).

I need to allow the user to something akin to a message box that passes back a message that tells me what was pushed and then pass that message back to
the onClick event of the button.

Thanks,

Tom

Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:%2***************@TK2MSFTNGP10.phx.gbl...
I am trying to set up a Javascript popup box that has a way of sending

back
a message to asp.net on how to process some data.

At the moment I am just doing:

myNextButton.Attributes.Add("onclick", "return confirm('Are you sure

you
want finish this test?');")

to attach a popup box to a button. The problem is that the buttons only
say
OK and Cancel. OK will take me to the event tied to the button and

Cancel,
in effect, says to do nothing and act as if the User never pressed the
button.

What I am trying to do is have something different on the button, such

as Proceed or Go Back and someway to tell asp.net on the postback which

button
was pushed.

The problem is that if you press the button, the event that is tied to
the
onClick button will fire, and will do any normal processing. I want it
to
process based on which buttons were pushed. Is there a way to send a
message to the event telling it what was done?

Thanks,

Tom



Nov 19 '05 #4
"Patrice" <no****@nowhere.com> wrote in message
news:Ot**************@TK2MSFTNGP14.phx.gbl...
Humm.. Sorry but still don't really understanding. So :
- you have a button. The users click on it.
- you want then to display a dialog box with two buttons A & B. If the
user
choose A you have a postback and an action, if the user choose B you have
also some action to perform.
- for some reason you can have directly both A & B buttons on the source
page (perhaps you don't know you'll have them bas this is base on some
server side condition)
I don't want the buttons on the source page as I want them to really see the
problem and a popup dialog is the best way (I think).

It does work the way I have it set up. The only problem is that I have no
idea that the user pressed a button or which button was pressed in asp.net
as the button was pressed in the client side script and not the server side
script.

The way it is set up is I have a button on the page (Submit). There is no
onClick event yet.

In my code, I find some situation that might necessitate my informing the
user of something I want him to do. So I "add" the event to the "Submit"
button, before he presses it.

When he presses it, the popup dialog appears which has 2 buttons on it - OK
and Cancel. Normal for a Javascript Confirm box.

When the OK button is pushed, it goes on with normal processing for the
Submit button. If Cancel is pressed, it will do nothing.
You could then :
- the user presses the button
- you open your own dialog
Not sure how to do this.
with those two buttons (suing
window.showModalDialog), you return (window.returnValue) which button was
pressed
- here based on this return value, you could call the click event of
either
the hidden "A" or the hidden "B" button.
- server side this will be seen as a click that is handled either by the A
event handler or the B event handler
Again, not sure how to handle this, but it sounds like it might work.

Tom
Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
> Not sure to follow. I would just have two distinct buttons on my
> ASP.NET
> Page each with its own click event handler server side. You can always ask > confirmation client side as you do now when one of these buttons is
> pressed...
>
> You could also create your won dialog if you prefer (but users would have > to
> press one button, then choos another button plus perhaps a cancel
> button
> in
> this dialog). I would just put two buttons on the source page.


No, the problem is that I want to put up a warning popup window, which I

am
doing now to alert the user that there is a problem and then be able to
handle the event based on which buttons he pushes. With the Confirm

popup,
you only get to go on as normal or do nothing. You also can't change the
text on the buttons (I don't think).

I need to allow the user to something akin to a message box that passes

back
a message that tells me what was pushed and then pass that message back
to
the onClick event of the button.

Thanks,

Tom
>
> Patrice
>
> --
>
> "tshad" <ts**********@ftsolutions.com> a écrit dans le message de
> news:%2***************@TK2MSFTNGP10.phx.gbl...
>> I am trying to set up a Javascript popup box that has a way of sending
> back
>> a message to asp.net on how to process some data.
>>
>> At the moment I am just doing:
>>
>> myNextButton.Attributes.Add("onclick", "return confirm('Are you
>> sure
> you
>> want finish this test?');")
>>
>> to attach a popup box to a button. The problem is that the buttons only > say
>> OK and Cancel. OK will take me to the event tied to the button and
> Cancel,
>> in effect, says to do nothing and act as if the User never pressed the
>> button.
>>
>> What I am trying to do is have something different on the button, such as >> Proceed or Go Back and someway to tell asp.net on the postback which
> button
>> was pushed.
>>
>> The problem is that if you press the button, the event that is tied to
>> the
>> onClick button will fire, and will do any normal processing. I want
>> it
>> to
>> process based on which buttons were pushed. Is there a way to send a
>> message to the event telling it what was done?
>>
>> Thanks,
>>
>> Tom
>>
>>
>
>



Nov 19 '05 #5
So you'll need on the first page :
- an hidden button A with its server side handler
- an hidden button B with its server side handler
- when clicking a button (not a submit button) you'll use window.open or
window.showModalDialog (please see the DHTML doc for details) to open a new
page
- on this page you have "Process method A" and "Process method B" buttons
- by using window.returnValue (see the DHTML doc) you'll return the selected
button to the caller
- in the first page, based on the return value, you should be able to call
either A.Click() or B.click() client side
- it will cause the page to postback and it should be seen by ASP.NET as if
the user had cliked the corresponding button
- in the server side handler you can then do what you intented...

Perhaps someone will come with a simpler suggestion

Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:ud**************@TK2MSFTNGP09.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:Ot**************@TK2MSFTNGP14.phx.gbl...
Humm.. Sorry but still don't really understanding. So :
- you have a button. The users click on it.
- you want then to display a dialog box with two buttons A & B. If the
user
choose A you have a postback and an action, if the user choose B you have also some action to perform.
- for some reason you can have directly both A & B buttons on the source
page (perhaps you don't know you'll have them bas this is base on some
server side condition)
I don't want the buttons on the source page as I want them to really see

the problem and a popup dialog is the best way (I think).

It does work the way I have it set up. The only problem is that I have no
idea that the user pressed a button or which button was pressed in asp.net
as the button was pressed in the client side script and not the server side script.

The way it is set up is I have a button on the page (Submit). There is no
onClick event yet.

In my code, I find some situation that might necessitate my informing the
user of something I want him to do. So I "add" the event to the "Submit"
button, before he presses it.

When he presses it, the popup dialog appears which has 2 buttons on it - OK and Cancel. Normal for a Javascript Confirm box.

When the OK button is pushed, it goes on with normal processing for the
Submit button. If Cancel is pressed, it will do nothing.

You could then :
- the user presses the button
- you open your own dialog


Not sure how to do this.
with those two buttons (suing
window.showModalDialog), you return (window.returnValue) which button was pressed
- here based on this return value, you could call the click event of
either
the hidden "A" or the hidden "B" button.
- server side this will be seen as a click that is handled either by the A event handler or the B event handler


Again, not sure how to handle this, but it sounds like it might work.

Tom

Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
> Not sure to follow. I would just have two distinct buttons on my
> ASP.NET
> Page each with its own click event handler server side. You can always
ask
> confirmation client side as you do now when one of these buttons is
> pressed...
>
> You could also create your won dialog if you prefer (but users would

have
> to
> press one button, then choos another button plus perhaps a cancel
> button
> in
> this dialog). I would just put two buttons on the source page.

No, the problem is that I want to put up a warning popup window, which
I am
doing now to alert the user that there is a problem and then be able to
handle the event based on which buttons he pushes. With the Confirm

popup,
you only get to go on as normal or do nothing. You also can't change
the text on the buttons (I don't think).

I need to allow the user to something akin to a message box that passes

back
a message that tells me what was pushed and then pass that message back
to
the onClick event of the button.

Thanks,

Tom
>
> Patrice
>
> --
>
> "tshad" <ts**********@ftsolutions.com> a écrit dans le message de
> news:%2***************@TK2MSFTNGP10.phx.gbl...
>> I am trying to set up a Javascript popup box that has a way of sending > back
>> a message to asp.net on how to process some data.
>>
>> At the moment I am just doing:
>>
>> myNextButton.Attributes.Add("onclick", "return confirm('Are you
>> sure
> you
>> want finish this test?');")
>>
>> to attach a popup box to a button. The problem is that the buttons

only
> say
>> OK and Cancel. OK will take me to the event tied to the button and
> Cancel,
>> in effect, says to do nothing and act as if the User never pressed the >> button.
>>
>> What I am trying to do is have something different on the button, such as
>> Proceed or Go Back and someway to tell asp.net on the postback which
> button
>> was pushed.
>>
>> The problem is that if you press the button, the event that is tied

to >> the
>> onClick button will fire, and will do any normal processing. I want
>> it
>> to
>> process based on which buttons were pushed. Is there a way to send a >> message to the event telling it what was done?
>>
>> Thanks,
>>
>> Tom
>>
>>
>
>



Nov 19 '05 #6
"Patrice" <no****@nowhere.com> wrote in message
news:u9*************@TK2MSFTNGP12.phx.gbl...
So you'll need on the first page :
- an hidden button A with its server side handler
- an hidden button B with its server side handler
- when clicking a button (not a submit button) you'll use window.open or
window.showModalDialog (please see the DHTML doc for details) to open a
new
page
The reason I am using Javascript prompt is that it is Modal (can't touch the
Parent page until I respond to the new window). Window.Open is not Modal
and ShowModalDialog only works in IE (this would have been perfect). Andy
Smith (Metabuilders) has a real good Dialog object, but it also isn't modal.

The Confirm box (Javascript) works fine, but when if the user presses the
Cancel button, it just stops. It doesn't generate and event that would
allow me to take an action.

Tom
- on this page you have "Process method A" and "Process method B" buttons
- by using window.returnValue (see the DHTML doc) you'll return the
selected
button to the caller
- in the first page, based on the return value, you should be able to call
either A.Click() or B.click() client side
- it will cause the page to postback and it should be seen by ASP.NET as
if
the user had cliked the corresponding button
- in the server side handler you can then do what you intented...

Perhaps someone will come with a simpler suggestion

Patrice

--

"tshad" <ts**********@ftsolutions.com> a écrit dans le message de
news:ud**************@TK2MSFTNGP09.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:Ot**************@TK2MSFTNGP14.phx.gbl...
> Humm.. Sorry but still don't really understanding. So :
> - you have a button. The users click on it.
> - you want then to display a dialog box with two buttons A & B. If the
> user
> choose A you have a postback and an action, if the user choose B you have > also some action to perform.
> - for some reason you can have directly both A & B buttons on the
> source
> page (perhaps you don't know you'll have them bas this is base on some
> server side condition)


I don't want the buttons on the source page as I want them to really see

the
problem and a popup dialog is the best way (I think).

It does work the way I have it set up. The only problem is that I have
no
idea that the user pressed a button or which button was pressed in
asp.net
as the button was pressed in the client side script and not the server

side
script.

The way it is set up is I have a button on the page (Submit). There is
no
onClick event yet.

In my code, I find some situation that might necessitate my informing the
user of something I want him to do. So I "add" the event to the "Submit"
button, before he presses it.

When he presses it, the popup dialog appears which has 2 buttons on it -

OK
and Cancel. Normal for a Javascript Confirm box.

When the OK button is pushed, it goes on with normal processing for the
Submit button. If Cancel is pressed, it will do nothing.
>
> You could then :
> - the user presses the button
> - you open your own dialog


Not sure how to do this.
>with those two buttons (suing
> window.showModalDialog), you return (window.returnValue) which button was > pressed
> - here based on this return value, you could call the click event of
> either
> the hidden "A" or the hidden "B" button.
> - server side this will be seen as a click that is handled either by
> the A > event handler or the B event handler


Again, not sure how to handle this, but it sounds like it might work.

Tom
>
> Patrice
>
> --
>
> "tshad" <ts**********@ftsolutions.com> a écrit dans le message de
> news:%2****************@TK2MSFTNGP14.phx.gbl...
>> "Patrice" <no****@nowhere.com> wrote in message
>> news:u6**************@tk2msftngp13.phx.gbl...
>> > Not sure to follow. I would just have two distinct buttons on my
>> > ASP.NET
>> > Page each with its own click event handler server side. You can always > ask
>> > confirmation client side as you do now when one of these buttons is
>> > pressed...
>> >
>> > You could also create your won dialog if you prefer (but users would
> have
>> > to
>> > press one button, then choos another button plus perhaps a cancel
>> > button
>> > in
>> > this dialog). I would just put two buttons on the source page.
>>
>> No, the problem is that I want to put up a warning popup window, which I > am
>> doing now to alert the user that there is a problem and then be able
>> to
>> handle the event based on which buttons he pushes. With the Confirm
> popup,
>> you only get to go on as normal or do nothing. You also can't change the >> text on the buttons (I don't think).
>>
>> I need to allow the user to something akin to a message box that
>> passes
> back
>> a message that tells me what was pushed and then pass that message
>> back
>> to
>> the onClick event of the button.
>>
>> Thanks,
>>
>> Tom
>> >
>> > Patrice
>> >
>> > --
>> >
>> > "tshad" <ts**********@ftsolutions.com> a écrit dans le message de
>> > news:%2***************@TK2MSFTNGP10.phx.gbl...
>> >> I am trying to set up a Javascript popup box that has a way of sending >> > back
>> >> a message to asp.net on how to process some data.
>> >>
>> >> At the moment I am just doing:
>> >>
>> >> myNextButton.Attributes.Add("onclick", "return confirm('Are you
>> >> sure
>> > you
>> >> want finish this test?');")
>> >>
>> >> to attach a popup box to a button. The problem is that the buttons
> only
>> > say
>> >> OK and Cancel. OK will take me to the event tied to the button and
>> > Cancel,
>> >> in effect, says to do nothing and act as if the User never pressed the >> >> button.
>> >>
>> >> What I am trying to do is have something different on the button, such > as
>> >> Proceed or Go Back and someway to tell asp.net on the postback
>> >> which
>> > button
>> >> was pushed.
>> >>
>> >> The problem is that if you press the button, the event that is tied to >> >> the
>> >> onClick button will fire, and will do any normal processing. I
>> >> want
>> >> it
>> >> to
>> >> process based on which buttons were pushed. Is there a way to send a >> >> message to the event telling it what was done?
>> >>
>> >> Thanks,
>> >>
>> >> Tom
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 19 '05 #7

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

Similar topics

9
by: Bob Bedford | last post by:
I've a page where the user may enter some values and upload some pictures. Unfortunately, some pictures coming from digital camera are very big, and take a lot of time for uploading. I've...
3
by: woodsie | last post by:
i'm looking for a back script that will work in Safari (on mac). the one below works fine in IE and netscape but not safari. <a href="#" onClick="history.go(-1)">go back</a> any help plz?
9
by: ben | last post by:
I have a web application whic connects to the database and populates a datagrid based on 2 fields the user enters on the web form. I have a try catch block to make sure that in case the user enters...
7
by: Grey | last post by:
how to design confirm message box, like Javascript Confirm box, in ASP.NET?? if the user click "YES" in the confirm box, i need to do something, else do other things. Do I need to have javascript...
6
by: Dave | last post by:
Hello. I want to prompt user for some action with Yes/No message, I know some tricks in JavaScript, but I need to handle the user answer at server side. Exactly I want to prompt user for...
2
by: Mike Moore | last post by:
asp.net app - How do you get Java-side code to communicate with server-side code? I have tried numerous ways and examples, but have been unsuccessful. Therefore, unless I get real lucky and find...
2
by: Microsoft News | last post by:
What I have is a message box that pops up. It is another browser window. The code is a general function that you pass message, title and a key to. The box works great except, that if you are on a...
6
by: Mark | last post by:
I'm building a web utility to do some processing that will run for several hours. Assume I have a valid reason for using the web for the utility. During the process I'd like to display an update...
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.