Solo para evitar el try catch y hacerlo mas limpio podría ser así:
Cita: Dim iddeinventario As Integer
If e.Item.Cells(2).Controls(0).GetType.Name.ToLower = "textbox" Then
Dim sValue As String = CType(CType(e.Item.Cells(2).Controls(0), TextBox).Text
sValue = IIf(IsNumeric(sValue), sValue, 0)
iddeinventario = CType(sValue,Integer)
Else
Response.write("Eso no es un textbox")
End If
Pero en fin... como siempre lo hemos dicho.. cada quien lo puede hacer como mejor lo crea conveniente
Salu2