Solved

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

Posted on 2004-09-13
6
1,326 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
character entities and entity references in XML 17 123
Finding the platform that was used to build a website 4 50
AngularJS directive issue 6 70
Select distinct 25 103
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
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 …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to dynamically set the form action using jQuery.

832 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