Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-13
6
Medium Priority
?
1,333 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
[X]
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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

688 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