使用SqlDataSource进行数据绑定,在编辑某一行的时候先判断该行是否允许编辑,不允许就提示,然后取消编辑状态。
代码如下:
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
If e.CommandName = "Edit" Then
If Me.GetEditFlag <> "1" Then
'提示
ClsCommon.AlerInAjax(Page, e.GetType, "此类别的参数代码不可修改!")
GridView1.EditIndex = -1
GridView1.DataSourceID = "SqlDataSource1"
GridView1.DataBind()
Exit Sub
End If
End If
End Sub
但怎么取消不了编辑状态呢??请大侠指教。
代码如下:
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
If e.CommandName = "Edit" Then
If Me.GetEditFlag <> "1" Then
'提示
ClsCommon.AlerInAjax(Page, e.GetType, "此类别的参数代码不可修改!")
GridView1.EditIndex = -1
GridView1.DataSourceID = "SqlDataSource1"
GridView1.DataBind()
Exit Sub
End If
End If
End Sub
但怎么取消不了编辑状态呢??请大侠指教。
If Me.GetEditFlag <> "1" Then
ClsCommon.AlerInAjax(Page, e.GetType, "此类别的参数代码不可修改!")
e.Cancel = True
Exit Sub
End If