473,289 Members | 1,940 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,289 software developers and data experts.

capturing messagebox OK/cancel event

Hi,

I have a messagebox that pops up due to an event. I did it in javascript.
ie. alert("Time's up. Assessment Ended");

I want to capture the OK and Cancel events of this alert messagebox. My code
is in C#/ASP.NET.

TIA.
Andrew.

Nov 19 '05 #1
10 5977
Andrew,

You need to pass the message box return value to the server side in the
value property of a hidden input control:

<input type=hidden id=inhTimeUp runat=server>

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
Hi,

I have a messagebox that pops up due to an event. I did it in javascript.
ie. alert("Time's up. Assessment Ended");

I want to capture the OK and Cancel events of this alert messagebox. My code is in C#/ASP.NET.

TIA.
Andrew.

Nov 19 '05 #2
Here's some server side code that uses javascript to display a confirmation
message.

myDeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

In this example, the Delete button will post back only if the person
confirms they want to delete. Otherwise the server code is never called in
response to the button click.

Here's more info:
http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
Hi,

I have a messagebox that pops up due to an event. I did it in javascript.
ie. alert("Time's up. Assessment Ended");

I want to capture the OK and Cancel events of this alert messagebox. My
code
is in C#/ASP.NET.

TIA.
Andrew.

Nov 19 '05 #3
I seem to have a problem capturing the id="inhTimeUp" of the hidden input
control.

As I understand it, I put the code:
<input type=hidden id=inhTimeUp runat=server>
onto the parent file's html page, then I want to access this "inhTimeUp"
from the iFrame (child) page, is that possible ? coz the parent aspx page
just displays the top part of my page, while the child displays the bottom
and majority of the code in C#.

Am I making sense ?
TIA.
Andrew.

"Steve C. Orr [MVP, MCSD]" wrote:
Here's some server side code that uses javascript to display a confirmation
message.

myDeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

In this example, the Delete button will post back only if the person
confirms they want to delete. Otherwise the server code is never called in
response to the button click.

Here's more info:
http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
Hi,

I have a messagebox that pops up due to an event. I did it in javascript.
ie. alert("Time's up. Assessment Ended");

I want to capture the OK and Cancel events of this alert messagebox. My
code
is in C#/ASP.NET.

TIA.
Andrew.


Nov 19 '05 #4
Andrew,

What's the reason for putting the control on the parent form? Which form
produces the messagebox and which form is interested in the value clicked?

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
I seem to have a problem capturing the id="inhTimeUp" of the hidden input
control.

As I understand it, I put the code:
<input type=hidden id=inhTimeUp runat=server>
onto the parent file's html page, then I want to access this "inhTimeUp"
from the iFrame (child) page, is that possible ? coz the parent aspx page
just displays the top part of my page, while the child displays the bottom
and majority of the code in C#.

Am I making sense ?
TIA.
Andrew.

"Steve C. Orr [MVP, MCSD]" wrote:
Here's some server side code that uses javascript to display a confirmation message.

myDeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

In this example, the Delete button will post back only if the person
confirms they want to delete. Otherwise the server code is never called in response to the button click.

Here's more info:
http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
Hi,

I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended");

I want to capture the OK and Cancel events of this alert messagebox. My code
is in C#/ASP.NET.

TIA.
Andrew.


Nov 19 '05 #5
I am writing an online assessment. The duration of the test 90 minutes.

Originally I had put everything on one page, but I discovered that whenever
the user clicks on NEXT question, the countdown re-starts. Obviously I don't
want that to happen.

I had to put the countdown (in javascript) textfield on the parent page, and
the question is displayed in the child page (iframe). The child form wants to
capture when the user clicks on the OK button of the:
alert("Time's up. Assessment Ended");

I hope this explains what I am trying to do. Is my design correct ?
TIA
Andrew.

"Eliyahu Goldin" wrote:
Andrew,

What's the reason for putting the control on the parent form? Which form
produces the messagebox and which form is interested in the value clicked?

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
I seem to have a problem capturing the id="inhTimeUp" of the hidden input
control.

As I understand it, I put the code:
<input type=hidden id=inhTimeUp runat=server>
onto the parent file's html page, then I want to access this "inhTimeUp"
from the iFrame (child) page, is that possible ? coz the parent aspx page
just displays the top part of my page, while the child displays the bottom
and majority of the code in C#.

Am I making sense ?
TIA.
Andrew.

"Steve C. Orr [MVP, MCSD]" wrote:
Here's some server side code that uses javascript to display a confirmation message.

myDeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

In this example, the Delete button will post back only if the person
confirms they want to delete. Otherwise the server code is never called in response to the button click.

Here's more info:
http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
> Hi,
>
> I have a messagebox that pops up due to an event. I did it in javascript. > ie. alert("Time's up. Assessment Ended");
>
> I want to capture the OK and Cancel events of this alert messagebox. My > code
> is in C#/ASP.NET.
>
> TIA.
> Andrew.
>


Nov 19 '05 #6
This is fine, but why can't you put the control in the child form? Anyway,
whatever your reason is, you can always access the control in the parent
page as

parent.document.getElementById("inhTimeUp");

and submit the parent form as

parent.myForm.submit();

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
I am writing an online assessment. The duration of the test 90 minutes.

Originally I had put everything on one page, but I discovered that whenever the user clicks on NEXT question, the countdown re-starts. Obviously I don't want that to happen.

I had to put the countdown (in javascript) textfield on the parent page, and the question is displayed in the child page (iframe). The child form wants to capture when the user clicks on the OK button of the:
alert("Time's up. Assessment Ended");

I hope this explains what I am trying to do. Is my design correct ?
TIA
Andrew.

"Eliyahu Goldin" wrote:
Andrew,

What's the reason for putting the control on the parent form? Which form
produces the messagebox and which form is interested in the value clicked?
Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
I seem to have a problem capturing the id="inhTimeUp" of the hidden input control.

As I understand it, I put the code:
<input type=hidden id=inhTimeUp runat=server>
onto the parent file's html page, then I want to access this "inhTimeUp" from the iFrame (child) page, is that possible ? coz the parent aspx page just displays the top part of my page, while the child displays the bottom and majority of the code in C#.

Am I making sense ?
TIA.
Andrew.

"Steve C. Orr [MVP, MCSD]" wrote:

> Here's some server side code that uses javascript to display a

confirmation
> message.
>
> myDeleteButton.Attributes.Add("onclick", _
> "return confirm('Are you sure you want to delete?');")
>
> In this example, the Delete button will post back only if the person
> confirms they want to delete. Otherwise the server code is never
called in
> response to the button click.
>
> Here's more info:
> http://SteveOrr.net/articles/ClientSideSuite.aspx
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
> "Andrew" <An****@discussions.microsoft.com> wrote in message
> news:04**********************************@microsof t.com...
> > Hi,
> >
> > I have a messagebox that pops up due to an event. I did it in

javascript.
> > ie. alert("Time's up. Assessment Ended");
> >
> > I want to capture the OK and Cancel events of this alert
messagebox. My
> > code
> > is in C#/ASP.NET.
> >
> > TIA.
> > Andrew.
> >
>
>
>


Nov 19 '05 #7
sorry, I do not really understand what you are saying. It's probably because
my javascript isn't great. Let me explain further.

I have IStartAss.aspx (parent) and StartAss.aspx (child iframe) to be
displayed.
On the parent page, there is the javascript code, and the hidden input text.

PARENT: The javascript looks like this (not sure if I am right):

<input type="hidden" id="inhTimeUp" runat="server" NAME="inhTimeUp">

<iframe id="Child_StartAss" src="StartAss.aspx" frameBorder="0"
runat="server"></iframe>

<SCRIPT language="Javascript">
....
alert("Time's up. Assessment Ended")
parent.document.getElementById("inhTimeUp") = true;
document.Form_IStartAss.submit();
</SCRIPT>

CHILD: There is some C# code.
I want to capture the event when the user clicks on the OK button and
proceed on.
How do I do this capturing ?

The reason why I am fussing about this capture is because later on I will
probably need to know how to do this in another part of the application
anyway.

TIA.
Andrew.

"Eliyahu Goldin" wrote:
This is fine, but why can't you put the control in the child form? Anyway,
whatever your reason is, you can always access the control in the parent
page as

parent.document.getElementById("inhTimeUp");

and submit the parent form as

parent.myForm.submit();

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
I am writing an online assessment. The duration of the test 90 minutes.

Originally I had put everything on one page, but I discovered that

whenever
the user clicks on NEXT question, the countdown re-starts. Obviously I

don't
want that to happen.

I had to put the countdown (in javascript) textfield on the parent page,

and
the question is displayed in the child page (iframe). The child form wants

to
capture when the user clicks on the OK button of the:
alert("Time's up. Assessment Ended");

I hope this explains what I am trying to do. Is my design correct ?
TIA
Andrew.

"Eliyahu Goldin" wrote:
Andrew,

What's the reason for putting the control on the parent form? Which form
produces the messagebox and which form is interested in the value clicked?
Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
> I seem to have a problem capturing the id="inhTimeUp" of the hidden input > control.
>
> As I understand it, I put the code:
> <input type=hidden id=inhTimeUp runat=server>
> onto the parent file's html page, then I want to access this "inhTimeUp" > from the iFrame (child) page, is that possible ? coz the parent aspx page > just displays the top part of my page, while the child displays the bottom > and majority of the code in C#.
>
> Am I making sense ?
> TIA.
> Andrew.
>
> "Steve C. Orr [MVP, MCSD]" wrote:
>
> > Here's some server side code that uses javascript to display a
confirmation
> > message.
> >
> > myDeleteButton.Attributes.Add("onclick", _
> > "return confirm('Are you sure you want to delete?');")
> >
> > In this example, the Delete button will post back only if the person
> > confirms they want to delete. Otherwise the server code is never called in
> > response to the button click.
> >
> > Here's more info:
> > http://SteveOrr.net/articles/ClientSideSuite.aspx
> >
> > --
> > I hope this helps,
> > Steve C. Orr, MCSD, MVP
> > http://SteveOrr.net
> >
> >
> > "Andrew" <An****@discussions.microsoft.com> wrote in message
> > news:04**********************************@microsof t.com...
> > > Hi,
> > >
> > > I have a messagebox that pops up due to an event. I did it in
javascript.
> > > ie. alert("Time's up. Assessment Ended");
> > >
> > > I want to capture the OK and Cancel events of this alert messagebox. My
> > > code
> > > is in C#/ASP.NET.
> > >
> > > TIA.
> > > Andrew.


Nov 19 '05 #8
Ok, I hope now I understand it better.

Your javascript is in the parent. the parent takes care of counting down the
assessment time. When the time is up, the parent want to notify the form in
the iframe. Is that correct?

If that is, the parent itself is not interested in the inhTimeUp value, it
just needs to pass this value to the form in the iframe and get that form to
sibmit with passing the value to the server-side c# code.

To make it happen, you need to move the inhTimeUp to the child, since the
the value should go to the child form server-side code. The message box is
produced on the parent and the parent will pass the value to the child as

document.getElementById("Child_StartAss").contentW indow.document.getElementB
yId("inhTimeUp").value=true;

and submit the child as

document.getElementById("Child_StartAss").contentW indow.myChildForm.submit()
;

where myChildForm is the id of the form in the iframe.

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
sorry, I do not really understand what you are saying. It's probably because my javascript isn't great. Let me explain further.

I have IStartAss.aspx (parent) and StartAss.aspx (child iframe) to be
displayed.
On the parent page, there is the javascript code, and the hidden input text.
PARENT: The javascript looks like this (not sure if I am right):

<input type="hidden" id="inhTimeUp" runat="server" NAME="inhTimeUp">

<iframe id="Child_StartAss" src="StartAss.aspx" frameBorder="0"
runat="server"></iframe>

<SCRIPT language="Javascript">
...
alert("Time's up. Assessment Ended")
parent.document.getElementById("inhTimeUp") = true;
document.Form_IStartAss.submit();
</SCRIPT>

CHILD: There is some C# code.
I want to capture the event when the user clicks on the OK button and
proceed on.
How do I do this capturing ?

The reason why I am fussing about this capture is because later on I will
probably need to know how to do this in another part of the application
anyway.

TIA.
Andrew.

"Eliyahu Goldin" wrote:
This is fine, but why can't you put the control in the child form? Anyway, whatever your reason is, you can always access the control in the parent
page as

parent.document.getElementById("inhTimeUp");

and submit the parent form as

parent.myForm.submit();

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
I am writing an online assessment. The duration of the test 90 minutes.
Originally I had put everything on one page, but I discovered that

whenever
the user clicks on NEXT question, the countdown re-starts. Obviously I

don't
want that to happen.

I had to put the countdown (in javascript) textfield on the parent page,
and
the question is displayed in the child page (iframe). The child form
wants to
capture when the user clicks on the OK button of the:
alert("Time's up. Assessment Ended");

I hope this explains what I am trying to do. Is my design correct ?
TIA
Andrew.

"Eliyahu Goldin" wrote:

> Andrew,
>
> What's the reason for putting the control on the parent form? Which
form > produces the messagebox and which form is interested in the value

clicked?
>
> Eliyahu
>
> "Andrew" <An****@discussions.microsoft.com> wrote in message
> news:68**********************************@microsof t.com...
> > I seem to have a problem capturing the id="inhTimeUp" of the hidden input
> > control.
> >
> > As I understand it, I put the code:
> > <input type=hidden id=inhTimeUp runat=server>
> > onto the parent file's html page, then I want to access this

"inhTimeUp"
> > from the iFrame (child) page, is that possible ? coz the parent
aspx page
> > just displays the top part of my page, while the child displays
the bottom
> > and majority of the code in C#.
> >
> > Am I making sense ?
> > TIA.
> > Andrew.
> >
> > "Steve C. Orr [MVP, MCSD]" wrote:
> >
> > > Here's some server side code that uses javascript to display a
> confirmation
> > > message.
> > >
> > > myDeleteButton.Attributes.Add("onclick", _
> > > "return confirm('Are you sure you want to delete?');")
> > >
> > > In this example, the Delete button will post back only if the

person > > > confirms they want to delete. Otherwise the server code is never

called
> in
> > > response to the button click.
> > >
> > > Here's more info:
> > > http://SteveOrr.net/articles/ClientSideSuite.aspx
> > >
> > > --
> > > I hope this helps,
> > > Steve C. Orr, MCSD, MVP
> > > http://SteveOrr.net
> > >
> > >
> > > "Andrew" <An****@discussions.microsoft.com> wrote in message
> > > news:04**********************************@microsof t.com...
> > > > Hi,
> > > >
> > > > I have a messagebox that pops up due to an event. I did it in
> javascript.
> > > > ie. alert("Time's up. Assessment Ended");
> > > >
> > > > I want to capture the OK and Cancel events of this alert

messagebox.
> My
> > > > code
> > > > is in C#/ASP.NET.
> > > >
> > > > TIA.
> > > > Andrew.

Nov 19 '05 #9
Hi,

I need to clarify some stuff.

1) What does "Child_StartAss" signify ?
2) Also what code should i put in the child c# page to capture the
value=true send by the parent page ? Do i need to
"ClientScriptBlockRegistered" it ?

TIA.
Andrew

"Eliyahu Goldin" wrote:
Ok, I hope now I understand it better.

Your javascript is in the parent. the parent takes care of counting down the
assessment time. When the time is up, the parent want to notify the form in
the iframe. Is that correct?

If that is, the parent itself is not interested in the inhTimeUp value, it
just needs to pass this value to the form in the iframe and get that form to
sibmit with passing the value to the server-side c# code.

To make it happen, you need to move the inhTimeUp to the child, since the
the value should go to the child form server-side code. The message box is
produced on the parent and the parent will pass the value to the child as

document.getElementById("Child_StartAss").contentW indow.document.getElementB
yId("inhTimeUp").value=true;

and submit the child as

document.getElementById("Child_StartAss").contentW indow.myChildForm.submit()
;

where myChildForm is the id of the form in the iframe.

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
sorry, I do not really understand what you are saying. It's probably

because
my javascript isn't great. Let me explain further.

I have IStartAss.aspx (parent) and StartAss.aspx (child iframe) to be
displayed.
On the parent page, there is the javascript code, and the hidden input

text.

PARENT: The javascript looks like this (not sure if I am right):

<input type="hidden" id="inhTimeUp" runat="server" NAME="inhTimeUp">

<iframe id="Child_StartAss" src="StartAss.aspx" frameBorder="0"
runat="server"></iframe>

<SCRIPT language="Javascript">
...
alert("Time's up. Assessment Ended")
parent.document.getElementById("inhTimeUp") = true;
document.Form_IStartAss.submit();
</SCRIPT>

CHILD: There is some C# code.
I want to capture the event when the user clicks on the OK button and
proceed on.
How do I do this capturing ?

The reason why I am fussing about this capture is because later on I will
probably need to know how to do this in another part of the application
anyway.

TIA.
Andrew.

"Eliyahu Goldin" wrote:
This is fine, but why can't you put the control in the child form? Anyway, whatever your reason is, you can always access the control in the parent
page as

parent.document.getElementById("inhTimeUp");

and submit the parent form as

parent.myForm.submit();

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
> I am writing an online assessment. The duration of the test 90 minutes. >
> Originally I had put everything on one page, but I discovered that
whenever
> the user clicks on NEXT question, the countdown re-starts. Obviously I
don't
> want that to happen.
>
> I had to put the countdown (in javascript) textfield on the parent page, and
> the question is displayed in the child page (iframe). The child form wants to
> capture when the user clicks on the OK button of the:
> alert("Time's up. Assessment Ended");
>
> I hope this explains what I am trying to do. Is my design correct ?
> TIA
> Andrew.
>
> "Eliyahu Goldin" wrote:
>
> > Andrew,
> >
> > What's the reason for putting the control on the parent form? Which form > > produces the messagebox and which form is interested in the value
clicked?
> >
> > Eliyahu
> >
> > "Andrew" <An****@discussions.microsoft.com> wrote in message
> > news:68**********************************@microsof t.com...
> > > I seem to have a problem capturing the id="inhTimeUp" of the hidden input
> > > control.
> > >
> > > As I understand it, I put the code:
> > > <input type=hidden id=inhTimeUp runat=server>
> > > onto the parent file's html page, then I want to access this
"inhTimeUp"
> > > from the iFrame (child) page, is that possible ? coz the parent aspx page
> > > just displays the top part of my page, while the child displays the bottom
> > > and majority of the code in C#.
> > >
> > > Am I making sense ?
> > > TIA.
> > > Andrew.
> > >
> > > "Steve C. Orr [MVP, MCSD]" wrote:
> > >
> > > > Here's some server side code that uses javascript to display a
> > confirmation
> > > > message.
> > > >
> > > > myDeleteButton.Attributes.Add("onclick", _
> > > > "return confirm('Are you sure you want to delete?');")
> > > >
> > > > In this example, the Delete button will post back only if the person > > > > confirms they want to delete. Otherwise the server code is never
called
> > in
> > > > response to the button click.
> > > >
> > > > Here's more info:
> > > > http://SteveOrr.net/articles/ClientSideSuite.aspx
> > > >
> > > > --
> > > > I hope this helps,
> > > > Steve C. Orr, MCSD, MVP
> > > > http://SteveOrr.net
> > > >
> > > >
> > > > "Andrew" <An****@discussions.microsoft.com> wrote in message
> > > > news:04**********************************@microsof t.com...
> > > > > Hi,
> > > > >
> > > > > I have a messagebox that pops up due to an event. I did it in
> > javascript.
> > > > > ie. alert("Time's up. Assessment Ended");
> > > > >
> > > > > I want to capture the OK and Cancel events of this alert
messagebox.
> > My
> > > > > code
> > > > > is in C#/ASP.NET.
> > > > >
> > > > > TIA.
> > > > > Andrew.


Nov 19 '05 #10
See inline.

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:48**********************************@microsof t.com...
Hi,

I need to clarify some stuff.

1) What does "Child_StartAss" signify ? That is the frame id from your code:
<iframe id="Child_StartAss" src="StartAss.aspx" frameBorder="0"
runat="server"></iframe>
2) Also what code should i put in the child c# page to capture the
value=true send by the parent page ? Do i need to
"ClientScriptBlockRegistered" it ? No. When you add a line
<input type="hidden" id="inhTimeUp" runat="server"> (note than you can
safely remove the NAME attribute inserted by the VS)
the VS designer will place a line
protected System.Web.UI.HtmlControls.HtmlInputHidden inhTimeUp;

inside you .cs file. In the .cs file you can just check

if (inhTimeUp.Value == "true")

Note, that you have to switch to VS design view from the HTML view for the
line to appear in the .cs file.

TIA.
Andrew

"Eliyahu Goldin" wrote:
Ok, I hope now I understand it better.

Your javascript is in the parent. the parent takes care of counting down the assessment time. When the time is up, the parent want to notify the form in the iframe. Is that correct?

If that is, the parent itself is not interested in the inhTimeUp value, it just needs to pass this value to the form in the iframe and get that form to sibmit with passing the value to the server-side c# code.

To make it happen, you need to move the inhTimeUp to the child, since the the value should go to the child form server-side code. The message box is produced on the parent and the parent will pass the value to the child as
document.getElementById("Child_StartAss").contentW indow.document.getElementB yId("inhTimeUp").value=true;

and submit the child as

document.getElementById("Child_StartAss").contentW indow.myChildForm.submit() ;

where myChildForm is the id of the form in the iframe.

Eliyahu

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
sorry, I do not really understand what you are saying. It's probably

because
my javascript isn't great. Let me explain further.

I have IStartAss.aspx (parent) and StartAss.aspx (child iframe) to be
displayed.
On the parent page, there is the javascript code, and the hidden input

text.

PARENT: The javascript looks like this (not sure if I am right):

<input type="hidden" id="inhTimeUp" runat="server" NAME="inhTimeUp">

<iframe id="Child_StartAss" src="StartAss.aspx" frameBorder="0"
runat="server"></iframe>

<SCRIPT language="Javascript">
...
alert("Time's up. Assessment Ended")
parent.document.getElementById("inhTimeUp") = true;
document.Form_IStartAss.submit();
</SCRIPT>

CHILD: There is some C# code.
I want to capture the event when the user clicks on the OK button and
proceed on.
How do I do this capturing ?

The reason why I am fussing about this capture is because later on I will probably need to know how to do this in another part of the application anyway.

TIA.
Andrew.

"Eliyahu Goldin" wrote:

> This is fine, but why can't you put the control in the child form?

Anyway,
> whatever your reason is, you can always access the control in the parent > page as
>
> parent.document.getElementById("inhTimeUp");
>
> and submit the parent form as
>
> parent.myForm.submit();
>
> Eliyahu
>
> "Andrew" <An****@discussions.microsoft.com> wrote in message
> news:6B**********************************@microsof t.com...
> > I am writing an online assessment. The duration of the test 90

minutes.
> >
> > Originally I had put everything on one page, but I discovered that
> whenever
> > the user clicks on NEXT question, the countdown re-starts. Obviously I > don't
> > want that to happen.
> >
> > I had to put the countdown (in javascript) textfield on the parent

page,
> and
> > the question is displayed in the child page (iframe). The child form
wants
> to
> > capture when the user clicks on the OK button of the:
> > alert("Time's up. Assessment Ended");
> >
> > I hope this explains what I am trying to do. Is my design correct
? > > TIA
> > Andrew.
> >
> > "Eliyahu Goldin" wrote:
> >
> > > Andrew,
> > >
> > > What's the reason for putting the control on the parent form? Which form
> > > produces the messagebox and which form is interested in the
value > clicked?
> > >
> > > Eliyahu
> > >
> > > "Andrew" <An****@discussions.microsoft.com> wrote in message
> > > news:68**********************************@microsof t.com...
> > > > I seem to have a problem capturing the id="inhTimeUp" of the

hidden
> input
> > > > control.
> > > >
> > > > As I understand it, I put the code:
> > > > <input type=hidden id=inhTimeUp runat=server>
> > > > onto the parent file's html page, then I want to access this
> "inhTimeUp"
> > > > from the iFrame (child) page, is that possible ? coz the parent aspx
> page
> > > > just displays the top part of my page, while the child
displays the
> bottom
> > > > and majority of the code in C#.
> > > >
> > > > Am I making sense ?
> > > > TIA.
> > > > Andrew.
> > > >
> > > > "Steve C. Orr [MVP, MCSD]" wrote:
> > > >
> > > > > Here's some server side code that uses javascript to display
a > > > confirmation
> > > > > message.
> > > > >
> > > > > myDeleteButton.Attributes.Add("onclick", _
> > > > > "return confirm('Are you sure you want to delete?');")
> > > > >
> > > > > In this example, the Delete button will post back only if the person
> > > > > confirms they want to delete. Otherwise the server code is

never > called
> > > in
> > > > > response to the button click.
> > > > >
> > > > > Here's more info:
> > > > > http://SteveOrr.net/articles/ClientSideSuite.aspx
> > > > >
> > > > > --
> > > > > I hope this helps,
> > > > > Steve C. Orr, MCSD, MVP
> > > > > http://SteveOrr.net
> > > > >
> > > > >
> > > > > "Andrew" <An****@discussions.microsoft.com> wrote in message
> > > > > news:04**********************************@microsof t.com...
> > > > > > Hi,
> > > > > >
> > > > > > I have a messagebox that pops up due to an event. I did it in > > > javascript.
> > > > > > ie. alert("Time's up. Assessment Ended");
> > > > > >
> > > > > > I want to capture the OK and Cancel events of this alert
> messagebox.
> > > My
> > > > > > code
> > > > > > is in C#/ASP.NET.
> > > > > >
> > > > > > TIA.
> > > > > > Andrew.


Nov 19 '05 #11

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

Similar topics

3
by: s-galit | last post by:
hi, i have a module that created a form, and the messageBox is shown in the closing event , but when the im choosing the "cancel" button in the messageBox the messageBox and also the form is...
3
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
13
by: Chris | last post by:
I can create Javascript confirm message boxes during page creation, etc adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed? I...
7
by: Pi | last post by:
I have an MDI parent with one or more children forms. Each child form has an engine thread that processes data. The child form's _Closing event is roughly 01 Private Sub...
1
by: Pi | last post by:
I have an MDI parent with one or more children forms. Each child form has an engine thread that processes data. The child form's _Closing event is roughly 01 Private Sub...
16
by: Al Santino | last post by:
Hi, It appears displaying a messagebox in a validating event will cancel the subsequent event. In the program below, button 2's click event doesn't fire if you open a dialog box in button 1's...
3
by: rajibnsu | last post by:
While searching for capturing video with a webcam I god the following code.It gives two errors.Says:The type or namespace name 'WebcamEventArgs' does not exit in the namespace 'WebCam_Capture' (are...
6
by: Goran Djuranovic | last post by:
Hi all, I have a VB.NET windows application that uses MDI form. When I try to delete a datagrid row from one of the MDI children forms, I use a MessageBox YesNo confirmation, which, after confirmed,...
1
by: karthikpl83 | last post by:
Hi, Can anyone tell me how to capture event.returnValue. I have two actions written in my script which will be called during onbeforeunload event. Whenever onbeforeunload event is called,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
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: 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...

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.