Dan_C
asked on
ASP.net Datagrid delete confirmation using VBScript on the Client -Side
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("lnkbu tDelete") Is Nothing) Then
CType(e.Item.FindControl(" lnkbutDele te"), 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 :LinkButto n>
</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 ----
---- Server-Side code ---
If Not (e.Item.FindControl("lnkbu
CType(e.Item.FindControl("
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
</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 ----
ASKER
Does not work when using vbScript on the client-side
This should works
CType(e.Item.FindControl(" lnkbutDele te"), LinkButton).Attributes.Add ("onClick" , "eval( 'DeleteConfirm()' )")
Or read this,
http://www.webreference.com/dhtml/column22/js-vbMsgBox.html
CType(e.Item.FindControl("
Or read this,
http://www.webreference.com/dhtml/column22/js-vbMsgBox.html
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CType(e.Item.FindControl("