Hello again,
I figured out how to do this. I've used ItemDataBound() method of the datagrid control. I am using CheckConditions() home-made function to check any conditions I want, and after that I am using returned value to Enable/Disable the button in the first cell e.Item.Cells(0).
Example:
Private Sub grdSelect_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdSelect.ItemDataBound
Dim sXYZ_Parameter As String
Dim bReturn As Boolean
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.SelectedItem Then
sXYZ_Parameter = "Place here any parameter to check for.."
bReturn = CheckConditions(sXYZ_Parameter)
If bReturn = False Then
'btn.Enabled = False
e.Item.Cells(0).Enabled = False
Else
'btn.Enabled = True
e.Item.Cells(0).Enabled = True
End If
End If
End Sub
Hope it will help to someboby
-Dmitriy:)
|