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

javascript confirm fires after deletion instead of before

TJS
javascript "confirm" fires after deletion instead of before deletion.
how do I get this to stop the processing ?

code
==================
Sub ShowAlert(ByVal s As string)
RegisterClientScriptBlock("CSP-showconfirm-function", _
"<s"+"cript language=""JavaScript"">" & vbCrLf & _
"function Show_confirm(s) {" & _
"return confirm(s); " & _
"}" & vbCrLf & _
"</s" + "cript>")
RegisterStartupScript("CSP-showconfirm", _
"<s"+"cript language=""JavaScript"">Show_confirm('" & _
s & "');</s"+"cript>")
End Sub
Sub Delete_Click(Sender As Object, e as System.Web.UI.ImageClickEventArgs)
call ShowAlert("Delete?")
Call delete()
End Sub
......

<form ...
<asp:ImageButton id="Btn_Delete" onclick="Delete_Click" Runat="Server"
ImageUrl="~/img/delete.gif" />
</form>
Nov 19 '05 #1
7 2000
Instead of all this Register... mess put just one line in the Page_Load
event:

Btn_Delete.Attributes("onclick")="return confirm('Delete?');"

And get rid of "call ShowAlert("Delete?")" either.

Eliyahu

"TJS" <no****@here.com> wrote in message
news:eT*************@TK2MSFTNGP14.phx.gbl...
javascript "confirm" fires after deletion instead of before deletion.
how do I get this to stop the processing ?

code
==================
Sub ShowAlert(ByVal s As string)
RegisterClientScriptBlock("CSP-showconfirm-function", _
"<s"+"cript language=""JavaScript"">" & vbCrLf & _
"function Show_confirm(s) {" & _
"return confirm(s); " & _
"}" & vbCrLf & _
"</s" + "cript>")
RegisterStartupScript("CSP-showconfirm", _
"<s"+"cript language=""JavaScript"">Show_confirm('" & _
s & "');</s"+"cript>")
End Sub
Sub Delete_Click(Sender As Object, e as System.Web.UI.ImageClickEventArgs)
call ShowAlert("Delete?")
Call delete()
End Sub
.....

<form ...
<asp:ImageButton id="Btn_Delete" onclick="Delete_Click" Runat="Server"
ImageUrl="~/img/delete.gif" />
</form>

Nov 19 '05 #2
TJS wrote:
javascript "confirm" fires after deletion instead of before deletion.
how do I get this to stop the processing ?

code
==================
Sub ShowAlert(ByVal s As string)
RegisterClientScriptBlock("CSP-showconfirm-function", _
"<s"+"cript language=""JavaScript"">" & vbCrLf & _
"function Show_confirm(s) {" & _
"return confirm(s); " & _
"}" & vbCrLf & _
"</s" + "cript>")
RegisterStartupScript("CSP-showconfirm", _
"<s"+"cript language=""JavaScript"">Show_confirm('" & _
s & "');</s"+"cript>")
End Sub
Sub Delete_Click(Sender As Object, e as
System.Web.UI.ImageClickEventArgs) call ShowAlert("Delete?")
Call delete()
End Sub
.....

<form ...
<asp:ImageButton id="Btn_Delete" onclick="Delete_Click" Runat="Server"
ImageUrl="~/img/delete.gif" />
</form>


What happens in your Delete_Click is this:
1) you add some script blocks to be rendered eventually
2) then you call delete ()
After this the page renders & gets sent to the browser,
which will display the confirm (which has nowhere to return to)
Hans Kesting
Nov 19 '05 #3
TJS
tried tht , but it does not fire at all
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Instead of all this Register... mess put just one line in the Page_Load
event:

Btn_Delete.Attributes("onclick")="return confirm('Delete?');"

And get rid of "call ShowAlert("Delete?")" either.

Eliyahu

"TJS" <no****@here.com> wrote in message
news:eT*************@TK2MSFTNGP14.phx.gbl...
javascript "confirm" fires after deletion instead of before deletion.
how do I get this to stop the processing ?

code
==================
Sub ShowAlert(ByVal s As string)
RegisterClientScriptBlock("CSP-showconfirm-function", _
"<s"+"cript language=""JavaScript"">" & vbCrLf & _
"function Show_confirm(s) {" & _
"return confirm(s); " & _
"}" & vbCrLf & _
"</s" + "cript>")
RegisterStartupScript("CSP-showconfirm", _
"<s"+"cript language=""JavaScript"">Show_confirm('" & _
s & "');</s"+"cript>")
End Sub
Sub Delete_Click(Sender As Object, e as
System.Web.UI.ImageClickEventArgs)
call ShowAlert("Delete?")
Call delete()
End Sub
.....

<form ...
<asp:ImageButton id="Btn_Delete" onclick="Delete_Click" Runat="Server"
ImageUrl="~/img/delete.gif" />
</form>


Nov 19 '05 #4
What doesn't fire? The confirm box or the server event? Check if the server
event set up correctly.

Eliyahu

"TJS" <no****@here.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
tried tht , but it does not fire at all
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Instead of all this Register... mess put just one line in the Page_Load
event:

Btn_Delete.Attributes("onclick")="return confirm('Delete?');"

And get rid of "call ShowAlert("Delete?")" either.

Eliyahu

"TJS" <no****@here.com> wrote in message
news:eT*************@TK2MSFTNGP14.phx.gbl...
javascript "confirm" fires after deletion instead of before deletion.
how do I get this to stop the processing ?

code
==================
Sub ShowAlert(ByVal s As string)
RegisterClientScriptBlock("CSP-showconfirm-function", _
"<s"+"cript language=""JavaScript"">" & vbCrLf & _
"function Show_confirm(s) {" & _
"return confirm(s); " & _
"}" & vbCrLf & _
"</s" + "cript>")
RegisterStartupScript("CSP-showconfirm", _
"<s"+"cript language=""JavaScript"">Show_confirm('" & _
s & "');</s"+"cript>")
End Sub
Sub Delete_Click(Sender As Object, e as
System.Web.UI.ImageClickEventArgs)
call ShowAlert("Delete?")
Call delete()
End Sub
.....

<form ...
<asp:ImageButton id="Btn_Delete" onclick="Delete_Click" Runat="Server"
ImageUrl="~/img/delete.gif" />
</form>



Nov 19 '05 #5
TJS
the confirm box does not fire , the event fires
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...
What doesn't fire? The confirm box or the server event? Check if the
server
event set up correctly.

Eliyahu

"TJS" <no****@here.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
tried tht , but it does not fire at all
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> Instead of all this Register... mess put just one line in the Page_Load
> event:
>
> Btn_Delete.Attributes("onclick")="return confirm('Delete?');"
>
> And get rid of "call ShowAlert("Delete?")" either.
>
> Eliyahu
>
> "TJS" <no****@here.com> wrote in message
> news:eT*************@TK2MSFTNGP14.phx.gbl...
>> javascript "confirm" fires after deletion instead of before deletion.
>> how do I get this to stop the processing ?
>>
>>
>>
>> code
>> ==================
>> Sub ShowAlert(ByVal s As string)
>> RegisterClientScriptBlock("CSP-showconfirm-function", _
>> "<s"+"cript language=""JavaScript"">" & vbCrLf & _
>> "function Show_confirm(s) {" & _
>> "return confirm(s); " & _
>> "}" & vbCrLf & _
>> "</s" + "cript>")
>> RegisterStartupScript("CSP-showconfirm", _
>> "<s"+"cript language=""JavaScript"">Show_confirm('" & _
>> s & "');</s"+"cript>")
>> End Sub
>>
>>
>> Sub Delete_Click(Sender As Object, e as
>> System.Web.UI.ImageClickEventArgs)
>> call ShowAlert("Delete?")
>> Call delete()
>> End Sub
>>
>>
>> .....
>>
>> <form ...
>> <asp:ImageButton id="Btn_Delete" onclick="Delete_Click" Runat="Server"
>> ImageUrl="~/img/delete.gif" />
>> </form>
>>
>>
>
>



Nov 19 '05 #6
Try

Btn_Delete.Attributes("onclick")=String.Format("\" {0}\"", "return
confirm('Delete?');")

Eliyahu

"TJS" <no****@here.com> wrote in message
news:eV****************@TK2MSFTNGP09.phx.gbl...
the confirm box does not fire , the event fires
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...
What doesn't fire? The confirm box or the server event? Check if the
server
event set up correctly.

Eliyahu

"TJS" <no****@here.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
tried tht , but it does not fire at all
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> Instead of all this Register... mess put just one line in the Page_Load > event:
>
> Btn_Delete.Attributes("onclick")="return confirm('Delete?');"
>
> And get rid of "call ShowAlert("Delete?")" either.
>
> Eliyahu
>
> "TJS" <no****@here.com> wrote in message
> news:eT*************@TK2MSFTNGP14.phx.gbl...
>> javascript "confirm" fires after deletion instead of before deletion. >> how do I get this to stop the processing ?
>>
>>
>>
>> code
>> ==================
>> Sub ShowAlert(ByVal s As string)
>> RegisterClientScriptBlock("CSP-showconfirm-function", _
>> "<s"+"cript language=""JavaScript"">" & vbCrLf & _
>> "function Show_confirm(s) {" & _
>> "return confirm(s); " & _
>> "}" & vbCrLf & _
>> "</s" + "cript>")
>> RegisterStartupScript("CSP-showconfirm", _
>> "<s"+"cript language=""JavaScript"">Show_confirm('" & _
>> s & "');</s"+"cript>")
>> End Sub
>>
>>
>> Sub Delete_Click(Sender As Object, e as
>> System.Web.UI.ImageClickEventArgs)
>> call ShowAlert("Delete?")
>> Call delete()
>> End Sub
>>
>>
>> .....
>>
>> <form ...
>> <asp:ImageButton id="Btn_Delete" onclick="Delete_Click" Runat="Server" >> ImageUrl="~/img/delete.gif" />
>> </form>
>>
>>
>
>



Nov 19 '05 #7
TJS
throws this error
Compiler Error Message: BC30518: Overload resolution failed because no
accessible 'Format' can be called with these arguments:
Nov 19 '05 #8

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

Similar topics

3
by: musclehead | last post by:
Hi everyone, I have, what I hope, will be a simple question. I have a basic JS function to pop-up a confirm delete dialog box when deleting a record from a DB: function confirmDelete() { var...
4
by: tfsmag | last post by:
Okay, I have a project management app i'm writing and in the left hand menu i have a treeview control that is populated with each project... in child nodes under each project node I have an "edit"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.