扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
<script runat="server"> Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) ' 用户在只读模式中点击"编辑"按钮的时候引发 Response.Write("Row editing...") ' 如果GridView已经处于编辑模式,就终止编辑操作 If Not GridView1.EditIndex = -1 Then e.Cancel = True End If End Sub Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) ' 当用户在编辑模式中点击"更新"按钮的时候引发 Response.Write("GridView: Row updating...<br/>") '此处可以选择终止事件,例如不允许用户更新数据 If User.IsInRole("Restricted") Then e.Cancel = True End If End Sub Protected Sub GridView1_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs) ' 当更新操作完成所时候引发 Response.Write("GridView: Row updated<br/>") If Not e.Exception Is Nothing Then ' 此处可以执行自定义的错误处理,完成之后设置ExceptionHandled = true e.ExceptionHandled = True End If ' 可以检测更新操作所影响的行数 Response.Write("<br />Affected rows: " & Server.HtmlEncode(e.AffectedRows)) End Sub Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) ' 当用户在编辑模式中点击"取消"按钮的时候引发 Response.Write("Edit canceled") End Sub Protected Sub SqlDataSource1_Updated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) ' 当更新操作完成之后引发 Response.Write("SqlDataSource: Update complete<br />") End Sub Protected Sub SqlDataSource1_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) ' 调用更新操作的时候引发 Response.Write("SqlDataSource: Updating...") End Sub </script> |
Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Dim f As FileUpload = DetailsView1.FindControl("FileUpload1") If f.HasFile Then ' 保存文件 End If End Sub |
Protected Sub FormView1_ItemDeleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewDeletedEventArgs) If (e.Exception Is Nothing) Then ' 删除文件 Response.Redirect(e.Values("AlbumID")) End If End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者