Protected Sub DisableEdits()
Dim c As Control
Dim content As ContentPlaceHolder
content = Page.Master.FindControl("ContentPlaceHolder1")
Dim EditOn As Boolean = False
Dim grid As GridView
Dim frow As GridViewRow
For Each c In content.Controls
If c.GetType() Is GetType(GridView) Then
grid = CType(c, GridView)
For Each frow In grid.Rows
If (frow.RowType = DataControlRowType.DataRow) Then
If frow.RowState = DataControlRowState.Edit Then
EditOn = True
End If
End If
Next
End If
Next
If EditOn = True Then
For Each c In content.Controls
If c.GetType() Is GetType(GridView) Then
grid = CType(c, GridView)
For Each frow In grid.Rows
If (frow.RowType = DataControlRowType.DataRow) Then
If Not frow.RowState = DataControlRowState.Edit Then
Dim btnEdit As LinkButton = frow.Cells(9).Controls(0)
btnEdit.Enabled = False
End If
End If
Next
End If
Next
Else
For Each c In content.Controls
If c.GetType() Is GetType(GridView) Then
grid = CType(c, GridView)
For Each frow In grid.Rows
If (frow.RowType = DataControlRowType.DataRow) Then
'If Not User.IsInRole(frow.DataItem("Number").ToString) Then
Dim btnEdit As LinkButton = frow.Cells(9).Controls(0)
btnEdit.Enabled = True
'End If
End If
Next
End If
Next
End If
End Sub