Question: How to check if this control is linkButton?

CType(e.Row.Cells(0).Controls(0), LinkButton)

This is inside grid view row data bound.

Answer: 
If you use `TemplateFields` you should use `FindControl` to get the reference to your control:

```
LinkButton myLinkButton = (LinkButton) e.Row.FindControl("LinkButtonID");

```

To answer your question how to check the type:

[Type Checking: typeof, GetType, or is?](https://stackoverflow.com/questions/983030/type-checking-typeof-gettype-or-is)

Another one is using `as` operator:

```
LinkButton myLinkButton = e.Row.Cells(0).Controls(0) as LinkButton;
if(myLinkButton != null); // successfull cast

```

**Edit** since `DataControlLinkButton` accessibility is [`Friend`](http://msdn.microsoft.com/en-us/library/08w05ey2(v=vs.90).aspx) you canot use it directly(apart from your own `GetType().ToString` approach). But because it inherits from `LinkButton` you can check that:

Via `Is`:

```
If TypeOf control Is LinkButton Then
    DirectCast(control, LinkButton).Visible = False
End If

```

Via `TryCast`(C# as operator):

```
Dim lbEdit = TryCast(e.Row.Cells(0).Controls(0), LinkButton)
If lbEdit IsNot Nothing Then
    lbEdit.Visible = False
End If

```

Via `GetType`:

```
If control.GetType() = GetType(LinkButton) Then
    DirectCast(control, LinkButton).Visible = False
End If

```
```
 Dim lnkbtn As LinkButton = CType(e.Row.Findcontrol("lnkbuttonname"), LinkButton)

Protected Sub dgrd_WWWH_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles dgrd_WWWH.RowCommand

Dim row As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow)
Dim txtwwwhid = CType(row.FindControl("txtwwwhid"), Label)
Dim txtwho = CType(row.FindControl("txtWho"), LinkButton)
Dim txtwho1 = CType(row.FindControl("txtWho1"), LinkButton)

End Sub

```