471,354 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 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 1888
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 discussion thread is closed

Replies have been disabled for this discussion.

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.