This based on whether a field (punchlist) contains 0, which is when the Edit
button will appear. Any other number in the field, the Edit- button is
supposed to be disabled.
Here is the code I have been trying:
Sub lnk_Item_Bound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If e.Item.ItemType <> ListItemType.Item AND e.Item.ItemType <>
ListItemType.AlternatingItem Then
return
End If
Dim link As Hyperlink
link = e.Item.Cells(0).Controls(0)
If e.Item.DataItem.Row("punchlist") = "0" Then
link.Visible = True
Else
link.visible = False
End If
End Sub
The only thing I have gained from this code is that only one row appears in
the datagrid...
Hope someone can help.
I suppose the sub lnk_Item_Bound is bound to the datagrid event
ItemDataBound.
Why do you return on ListItemType.Item and ListItemType.AlternatingItem?
These are actually the ListItemTypes you want to edit.
Try if this solves your issues.
Private Sub lnk_Item_Bound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
Dim itemType As ListItemType = e.Item.ItemType
If ((itemType = ListItemType.Pager) Or (itemType =
ListItemType.Header) Or _
(itemType = ListItemType.Footer)) Then
Return
Else
> Dim link As Hyperlink
> link = e.Item.Cells(0).Controls(0)
>
> If e.Item.DataItem.Row("punchlist") = "0" Then
> link.Visible = True
> Else
> link.visible = False
> End If
End If
End Sub
Hope this helps,
Gregor
"Beate Wågen" <beate...@sireko.no> wrote in message
news:OqEzjSpdCHA.2408@tkmsftngp11...