html 文件:
<asp:GridView ID="GVA" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="0" CellSpacing="1"
GridLines="Horizontal" Style="font-size: 11pt; text-align: center">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<Columns>
<asp:BoundField DataField="c0" HeaderText="類別" />
<asp:BoundField DataField="c1" HeaderText="名稱" />
<asp:BoundField DataField="c2" HeaderText="數目" />
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
code:

Protected Sub GVA_RowEditing()Sub GVA_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GVA.RowEditing

GVA.EditIndex = e.NewEditIndex
fail_gv("682")
Dim i As Integer
For i = 0 To GVA.Rows.Count - 1
CType(GVA.Rows(i).Cells(3).Controls(0), LinkButton).Attributes.Add("onclick", "var e=window.confirm('更新嗎?');if(e){return true;}else{return false;}")
Next
End Sub


Protected Sub GVA_RowCancelingEdit()Sub GVA_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GVA.RowCancelingEdit
Me.GVA.EditIndex = -1
fail_gv("682")
Dim i As Integer
For i = 0 To GVA.Rows.Count - 1
CType(GVA.Rows(i).Cells(3).Controls(0), LinkButton).Attributes.Add("onclick", "var e=window.confirm('編輯11嗎?');if(e){return true;}else{return false;}")
Next
End Sub



Protected Sub GVA_RowUpdating()Sub GVA_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GVA.RowUpdating
Me.GVA.EditIndex = -1
fail_gv("682")
Dim i As Integer
For i = 0 To GVA.Rows.Count - 1
CType(GVA.Rows(i).Cells(3).Controls(0), LinkButton).Attributes.Add("onclick", "var e=window.confirm('編輯12嗎?');if(e){return true;}else{return false;}")
Next
End Sub


Protected Sub GVA_RowDeleting()Sub GVA_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVA.RowDeleting
GVA.EditIndex = -1
fail_gv("682")
'Dim i As Integer
'For i = 0 To GVA.Rows.Count - 1
' CType(GVA.Rows(i).Cells(3).Controls(0), LinkButton).Attributes.Add("onclick", "var e=window.confirm('更新嗎?');if(e){return true;}else{return false;}")
'Next
End Sub

















code:








































