Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

840 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