Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: confirmation message box


Message #1 by "eyetalion" <eyetalion1@h...> on Wed, 22 Jan 2003 16:23:15
In my datagrid I have a delete button. When the user clicks this button 
I'd like to know which row it is and confirm that they want to delete the 
row. I've been successful with displaying a conformation box with a 
regular web control button, but have had some difficulties when the 
button is inside a datagrid...any help would be appreciatred..thanks

Heres my code...no errors, but also no message box...

 Public Sub DeleteBid(ByVal source As Object, ByVal e As 
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles 
DataGrid1.DeleteCommand
        'check which row has been selected
        Dim selectedRow As String = DataGrid1.DataKeys(e.Item.ItemIndex)
        Dim btnDelete As Button
        btnDelete = e.Item.Cells(4).Controls(0) '<---5th column, first 
control 
        btnDelete.Attributes("onclick") = "javascript:return confirm('Are 
you sure you want to delete \n    Bid Record " & selectedRow & "?')"
Message #2 by "Carole D Sullivan" <carolesullivan@e...> on Wed, 22 Jan 2003 18:24:04
I have not tried this, but you might find this article helpful:

This is subject of one of the FAQ's on the page.

http://www.wintellect.com/resources/faqs/default.aspx?faq_id=1&page=5

> In my datagrid I have a delete button. When the user clicks this button 
I> 'd like to know which row it is and confirm that they want to delete 
the 
r> ow. I've been successful with displaying a conformation box with a 
r> egular web control button, but have had some difficulties when the 
b> utton is inside a datagrid...any help would be appreciatred..thanks

> Heres my code...no errors, but also no message box...

>  Public Sub DeleteBid(ByVal source As Object, ByVal e As 
S> ystem.Web.UI.WebControls.DataGridCommandEventArgs) Handles 
D> ataGrid1.DeleteCommand
 >        'check which row has been selected
 >        Dim selectedRow As String = DataGrid1.DataKeys(e.Item.ItemIndex)
 >        Dim btnDelete As Button
 >        btnDelete = e.Item.Cells(4).Controls(0) '<---5th column, first 
c> ontrol 
 >        btnDelete.Attributes("onclick") = "javascript:return confirm
('Are 
y> ou sure you want to delete \n    Bid Record " & selectedRow & "?')"

  Return to Index