dataview的編輯,更新,刪除,取消等事件

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

code:
ExpandedBlockStart.gif ContractedBlock.gif   Protected   Sub GVA_RowEditing() Sub GVA_RowEditing(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GVA.RowEditing
InBlock.gif
InBlock.gif        GVA.EditIndex 
= e.NewEditIndex
InBlock.gif        fail_gv(
"682")
InBlock.gif        
Dim i As Integer
InBlock.gif        
For i = 0 To GVA.Rows.Count - 1
InBlock.gif            
CType(GVA.Rows(i).Cells(3).Controls(0), LinkButton).Attributes.Add("onclick""var e=window.confirm('更新嗎?');if(e){return true;}else{return false;}")
InBlock.gif        
Next
ExpandedBlockEnd.gif    
End Sub

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值