473,379 Members | 1,423 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,379 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 1999
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"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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...

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.