DbClick to delete record in DataGrid

类别:Asp 点击:0 评论:0 推荐:

    Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
     'dbclick to delete
        If ((e.Item.ItemType = ListItemType.Item) Or (e.Item.ItemType = ListItemType.AlternatingItem) Or (e.Item.ItemType = ListItemType.SelectedItem)) Then
            e.Item.Attributes.Add("ondblclick", "javascript:if(confirm('delete " + e.Item.Cells(1).Text + "?')==true) {document.Form1.hidden1.value='delete test';window.Form1.submit();}")
        End If

    End Sub

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   if document.Form1.hidden1.value="delete test" then

      'delete record in database

   end if

   end sub

本文地址:http://com.8s8s.com/it/it8930.htm