Solved

ASP.net Datagrid delete confirmation using VBScript on the Client -Side

Posted on 2004-09-13
6
1,324 Views
Last Modified: 2010-04-06
Who can I do a delete confirmation on a asp.net DataGrid using vb language on the client and the server. I can't seem to get the submit to cancel when you answer no to the prompt.

---- Server-Side code ---

 If Not (e.Item.FindControl("lnkbutDelete") Is Nothing) Then
    CType(e.Item.FindControl("lnkbutDelete"), LinkButton).Attributes.Add("onClick", "DeleteConfirm()")
End If

---- End Server-Side Code ---


---- Client- Side Code ----
This is the Template column for the delete button in the Datagrid

<ItemTemplate>
<asp:LinkButton id="lnkbutDelete" runat="server" Text="<img border=0 src=images/im_delete.gif alt=delete>"
CommandName="Delete"></asp:LinkButton>
</ItemTemplate>

This is the function I build on the client using the VBscript MSGBOX

Function DeleteConfirm()
If MsgBox ("Are you sure you want to Delete this Record?",4,"Delete Client View Billing Info?") = 6 THEN
Form1_onsubmit =True
Else
Form1_onsubmit = False
End if
End Function

--- End Client-SIde Code ----
0
Comment
Question by:Dan_C
  • 2
  • 2
6 Comments
 
LVL 20

Expert Comment

by:ihenry
ID: 12046355
use this

CType(e.Item.FindControl("lnkbutDelete"), LinkButton).Attributes.Add("onClick", "return DeleteConfirm()")
0
 

Author Comment

by:Dan_C
ID: 12046401
Does not work when using vbScript on the client-side
0
 
LVL 20

Expert Comment

by:ihenry
ID: 12046708
This should works

CType(e.Item.FindControl("lnkbutDelete"), LinkButton).Attributes.Add("onClick", "eval( 'DeleteConfirm()' )")

Or read this,

http://www.webreference.com/dhtml/column22/js-vbMsgBox.html
0
 

Author Comment

by:Dan_C
ID: 12047011
Thanks but I was able to get it to work by using:

 Add("onClick", "javascript: return confirm('Are you sure you want to delete this record?');")

 rather then

.Add("onClick", "return confirm('Are you sure you want to delete this record?');")

I guess I had to explicitly tell it Javascript being I am using vbScript on the client.

Thanks for you help anyway
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12083918
Please read entire thread.  Asker solved or content important.
Closed, 125 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now