confirm in asp.net

B

Betina Andersen

Hi

The following was posted in microsoft.public.dotnet.languages.vb - but they
sait it could not be done, and that I should have posted here instead.


I am using vb in asp.net and I need to have a confirm in the middle of my
code(code-behind), but cannot get the confirm to display when I want it, but
it comes when my button has ended it code, any help appriciated.

Sub Button_Click
<code>
..
..
Dim scriptString As New StringBuilder
scriptString.Append("<script language='javascript' type='text/javascript'>")
scriptString.Append("var ok=confirm('Budget findes i forvejen - Ønskes det
overskrevet?\n" & strIkkeKopieret & "');" & "document.getElementById('" &
Skjult.ClientID & "').value=ok;")
scriptString.Append("</")
scriptString.Append("script>")
ScriptManager.RegisterStartupScript(sender, Me.GetType, "Info",
scriptString.ToString, False)
..
..
<mere kode>
End Sub

Then the box shows here and not where I definded it to? I tries both the
ScriptManager.RegisterStartupScript and
theScriptManager.RegisterClienScriptBlock, I am using Ajax, so it has to be
ScriptManager I have to use, as I understand it.

Regards Betina
 
D

Dave Bush

Your problem is that you are thinking of web development as though it is
windows development. When programming windows, your presentation layer
and processing layer are tightly coupled so that if you say, "do this
now" it actually happens exactly at that point.

When you are developing for the web, your code behind is creating the
entire presentation in one chunch, sending it back to the browser and
then the browser renders it in one chunk.

It may be best if you describe the problem you are trying to solve
rather than describing the solution you are trying to implement.

-----Original Message-----
From: Betina Andersen [mailto:[email protected]]
Posted At: Tuesday, October 30, 2007 8:16 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: confirm in asp.net
Subject: confirm in asp.net

Hi

The following was posted in microsoft.public.dotnet.languages.vb - but
they
sait it could not be done, and that I should have posted here instead.


I am using vb in asp.net and I need to have a confirm in the middle of
my
code(code-behind), but cannot get the confirm to display when I want it,
but
it comes when my button has ended it code, any help appriciated.

Sub Button_Click
<code>
..
..
Dim scriptString As New StringBuilder
scriptString.Append("<script language='javascript'
type='text/javascript'>")
scriptString.Append("var ok=confirm('Budget findes i forvejen - Ønskes
det
overskrevet?\n" & strIkkeKopieret & "');" & "document.getElementById('"
&
Skjult.ClientID & "').value=ok;")
scriptString.Append("</")
scriptString.Append("script>")
ScriptManager.RegisterStartupScript(sender, Me.GetType, "Info",
scriptString.ToString, False)
..
..
<mere kode>
End Sub

Then the box shows here and not where I definded it to? I tries both the
ScriptManager.RegisterStartupScript and
theScriptManager.RegisterClienScriptBlock, I am using Ajax, so it has to
be
ScriptManager I have to use, as I understand it.

Regards Betina
 
B

Betina Andersen

I have some code, from that code plus what the user has entered in the
browser, I creates an sql that checks something in a database, if there are
rows, the user has to be asked whether they will continue or not, if yes I
then has to proceed with my code - later in the code, again I have to ask
whether they will continue or not and I need to alert them also in the
middle of the code in my nutton.

Regards Betina
 
D

Dave Bush

You are going to have to do it in multiple pages, or use ajax.

First round trip - check database and return screen asking to continue.
Second round trip - respond to continue..

The browser and the server have to play ping pong with each other. You
can make it look like they aren't by using ajax, but you are still
really going to be playing ping pong.

-----Original Message-----
From: Betina Andersen [mailto:[email protected]]
Posted At: Tuesday, October 30, 2007 8:54 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: confirm in asp.net
Subject: Re: confirm in asp.net

I have some code, from that code plus what the user has entered in the
browser, I creates an sql that checks something in a database, if there
are
rows, the user has to be asked whether they will continue or not, if yes
I
then has to proceed with my code - later in the code, again I have to
ask
whether they will continue or not and I need to alert them also in the
middle of the code in my nutton.

Regards Betina


Dave Bush said:
Your problem is that you are thinking of web development as though it is
windows development. When programming windows, your presentation layer
and processing layer are tightly coupled so that if you say, "do this
now" it actually happens exactly at that point.

When you are developing for the web, your code behind is creating the
entire presentation in one chunch, sending it back to the browser and
then the browser renders it in one chunk.

It may be best if you describe the problem you are trying to solve
rather than describing the solution you are trying to implement.

-----Original Message-----
From: Betina Andersen [mailto:[email protected]]
Posted At: Tuesday, October 30, 2007 8:16 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: confirm in asp.net
Subject: confirm in asp.net

Hi

The following was posted in microsoft.public.dotnet.languages.vb - but
they
sait it could not be done, and that I should have posted here instead.


I am using vb in asp.net and I need to have a confirm in the middle of
my
code(code-behind), but cannot get the confirm to display when I want it,
but
it comes when my button has ended it code, any help appriciated.

Sub Button_Click
<code>
.
.
Dim scriptString As New StringBuilder
scriptString.Append("<script language='javascript'
type='text/javascript'>")
scriptString.Append("var ok=confirm('Budget findes i forvejen - Ønskes
det
overskrevet?\n" & strIkkeKopieret & "');" & "document.getElementById('"
&
Skjult.ClientID & "').value=ok;")
scriptString.Append("</")
scriptString.Append("script>")
ScriptManager.RegisterStartupScript(sender, Me.GetType, "Info",
scriptString.ToString, False)
.
.
<mere kode>
End Sub

Then the box shows here and not where I definded it to? I tries both the
ScriptManager.RegisterStartupScript and
theScriptManager.RegisterClienScriptBlock, I am using Ajax, so it has to
be
ScriptManager I have to use, as I understand it.

Regards Betina
 
B

Betina Andersen

I have Ajax on my page, do you have a suggestion to how I can do this?

Regards Betina

Dave Bush said:
You are going to have to do it in multiple pages, or use ajax.

First round trip - check database and return screen asking to continue.
Second round trip - respond to continue..

The browser and the server have to play ping pong with each other. You
can make it look like they aren't by using ajax, but you are still
really going to be playing ping pong.

-----Original Message-----
From: Betina Andersen [mailto:[email protected]]
Posted At: Tuesday, October 30, 2007 8:54 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: confirm in asp.net
Subject: Re: confirm in asp.net

I have some code, from that code plus what the user has entered in the
browser, I creates an sql that checks something in a database, if there
are
rows, the user has to be asked whether they will continue or not, if yes
I
then has to proceed with my code - later in the code, again I have to
ask
whether they will continue or not and I need to alert them also in the
middle of the code in my nutton.

Regards Betina


Dave Bush said:
Your problem is that you are thinking of web development as though it is
windows development. When programming windows, your presentation layer
and processing layer are tightly coupled so that if you say, "do this
now" it actually happens exactly at that point.

When you are developing for the web, your code behind is creating the
entire presentation in one chunch, sending it back to the browser and
then the browser renders it in one chunk.

It may be best if you describe the problem you are trying to solve
rather than describing the solution you are trying to implement.

-----Original Message-----
From: Betina Andersen [mailto:[email protected]]
Posted At: Tuesday, October 30, 2007 8:16 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: confirm in asp.net
Subject: confirm in asp.net

Hi

The following was posted in microsoft.public.dotnet.languages.vb - but
they
sait it could not be done, and that I should have posted here instead.


I am using vb in asp.net and I need to have a confirm in the middle of
my
code(code-behind), but cannot get the confirm to display when I want it,
but
it comes when my button has ended it code, any help appriciated.

Sub Button_Click
<code>
.
.
Dim scriptString As New StringBuilder
scriptString.Append("<script language='javascript'
type='text/javascript'>")
scriptString.Append("var ok=confirm('Budget findes i forvejen - Ønskes
det
overskrevet?\n" & strIkkeKopieret & "');" & "document.getElementById('"
&
Skjult.ClientID & "').value=ok;")
scriptString.Append("</")
scriptString.Append("script>")
ScriptManager.RegisterStartupScript(sender, Me.GetType, "Info",
scriptString.ToString, False)
.
.
<mere kode>
End Sub

Then the box shows here and not where I definded it to? I tries both the
ScriptManager.RegisterStartupScript and
theScriptManager.RegisterClienScriptBlock, I am using Ajax, so it has to
be
ScriptManager I have to use, as I understand it.

Regards Betina
 
P

Patrice

Or you could see if a confirmation is needed when rendering the first page
and insert the javascript code that triggers this action when the event that
should trigger this confirmation is happening. Then when you are back to
running server side code you don't have to handle a client side confirmation
that was done before calling back the server side page.

Betina Andersen said:
I have some code, from that code plus what the user has entered in the
browser, I creates an sql that checks something in a database, if there are
rows, the user has to be asked whether they will continue or not, if yes I
then has to proceed with my code - later in the code, again I have to ask
whether they will continue or not and I need to alert them also in the
middle of the code in my nutton.

Regards Betina


Dave Bush said:
Your problem is that you are thinking of web development as though it is
windows development. When programming windows, your presentation layer
and processing layer are tightly coupled so that if you say, "do this
now" it actually happens exactly at that point.

When you are developing for the web, your code behind is creating the
entire presentation in one chunch, sending it back to the browser and
then the browser renders it in one chunk.

It may be best if you describe the problem you are trying to solve
rather than describing the solution you are trying to implement.

-----Original Message-----
From: Betina Andersen [mailto:[email protected]]
Posted At: Tuesday, October 30, 2007 8:16 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: confirm in asp.net
Subject: confirm in asp.net

Hi

The following was posted in microsoft.public.dotnet.languages.vb - but
they
sait it could not be done, and that I should have posted here instead.


I am using vb in asp.net and I need to have a confirm in the middle of
my
code(code-behind), but cannot get the confirm to display when I want it,
but
it comes when my button has ended it code, any help appriciated.

Sub Button_Click
<code>
.
.
Dim scriptString As New StringBuilder
scriptString.Append("<script language='javascript'
type='text/javascript'>")
scriptString.Append("var ok=confirm('Budget findes i forvejen - Ønskes
det
overskrevet?\n" & strIkkeKopieret & "');" & "document.getElementById('"
&
Skjult.ClientID & "').value=ok;")
scriptString.Append("</")
scriptString.Append("script>")
ScriptManager.RegisterStartupScript(sender, Me.GetType, "Info",
scriptString.ToString, False)
.
.
<mere kode>
End Sub

Then the box shows here and not where I definded it to? I tries both the
ScriptManager.RegisterStartupScript and
theScriptManager.RegisterClienScriptBlock, I am using Ajax, so it has to
be
ScriptManager I have to use, as I understand it.

Regards Betina
 
B

Betina Andersen

I dont know how I can do that, since the confirm should appear in a
Button_Click code and is dependant of what the user has enteret in the
browserpage.

Regards Betina


Patrice said:
Or you could see if a confirmation is needed when rendering the first page
and insert the javascript code that triggers this action when the event
that should trigger this confirmation is happening. Then when you are back
to running server side code you don't have to handle a client side
confirmation that was done before calling back the server side page.

Betina Andersen said:
I have some code, from that code plus what the user has entered in the
browser, I creates an sql that checks something in a database, if there
are rows, the user has to be asked whether they will continue or not, if
yes I then has to proceed with my code - later in the code, again I have
to ask whether they will continue or not and I need to alert them also in
the middle of the code in my nutton.

Regards Betina


Dave Bush said:
Your problem is that you are thinking of web development as though it is
windows development. When programming windows, your presentation layer
and processing layer are tightly coupled so that if you say, "do this
now" it actually happens exactly at that point.

When you are developing for the web, your code behind is creating the
entire presentation in one chunch, sending it back to the browser and
then the browser renders it in one chunk.

It may be best if you describe the problem you are trying to solve
rather than describing the solution you are trying to implement.

-----Original Message-----
From: Betina Andersen [mailto:[email protected]]
Posted At: Tuesday, October 30, 2007 8:16 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: confirm in asp.net
Subject: confirm in asp.net

Hi

The following was posted in microsoft.public.dotnet.languages.vb - but
they
sait it could not be done, and that I should have posted here instead.


I am using vb in asp.net and I need to have a confirm in the middle of
my
code(code-behind), but cannot get the confirm to display when I want it,
but
it comes when my button has ended it code, any help appriciated.

Sub Button_Click
<code>
.
.
Dim scriptString As New StringBuilder
scriptString.Append("<script language='javascript'
type='text/javascript'>")
scriptString.Append("var ok=confirm('Budget findes i forvejen - Ønskes
det
overskrevet?\n" & strIkkeKopieret & "');" & "document.getElementById('"
&
Skjult.ClientID & "').value=ok;")
scriptString.Append("</")
scriptString.Append("script>")
ScriptManager.RegisterStartupScript(sender, Me.GetType, "Info",
scriptString.ToString, False)
.
.
<mere kode>
End Sub

Then the box shows here and not where I definded it to? I tries both the
ScriptManager.RegisterStartupScript and
theScriptManager.RegisterClienScriptBlock, I am using Ajax, so it has to
be
ScriptManager I have to use, as I understand it.

Regards Betina
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top