-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDefault.aspx.vb
More file actions
42 lines (38 loc) · 1.65 KB
/
Default.aspx.vb
File metadata and controls
42 lines (38 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Imports System
Imports System.Data
Imports System.Web.UI.WebControls
Imports DevExpress.Utils
Imports DevExpress.Web
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub ASPxGridView1_CommandButtonInitialize(ByVal sender As Object, ByVal e As ASPxGridViewCommandButtonEventArgs)
If e.VisibleIndex = -1 Then
Return
End If
Select Case e.ButtonType
Case ColumnCommandButtonType.Edit
e.Visible = EditButtonVisibleCriteria(DirectCast(sender, ASPxGridView), e.VisibleIndex)
Case ColumnCommandButtonType.Delete
e.Visible = DeleteButtonVisibleCriteria(DirectCast(sender, ASPxGridView), e.VisibleIndex)
End Select
End Sub
Protected Sub ASPxGridView1_CustomButtonInitialize(ByVal sender As Object, ByVal e As ASPxGridViewCustomButtonEventArgs)
If e.VisibleIndex = -1 Then
Return
End If
If e.ButtonID = "btnCustom" AndAlso e.VisibleIndex Mod 2 <> 0 Then
e.Visible = DefaultBoolean.False
End If
End Sub
Protected Sub AccessDataSource1_Modifying(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs)
Throw New InvalidOperationException("Data modifications are not allowed in online examples")
End Sub
Private Function EditButtonVisibleCriteria(ByVal grid As ASPxGridView, ByVal visibleIndex As Integer) As Boolean
Dim row As Object = grid.GetRow(visibleIndex)
Return DirectCast(row, DataRowView)("ProductName").ToString().Contains("a")
End Function
Private Function DeleteButtonVisibleCriteria(ByVal grid As ASPxGridView, ByVal visibleIndex As Integer) As Boolean
Dim row As Object = grid.GetRow(visibleIndex)
Return DirectCast(row, DataRowView)("ProductName").ToString().Contains("b")
End Function
End Class