Ciao a tutti, dovrei riuscire a rendere visibili dei bottoni in un datagrid solo se l'utente ha effettuato la login... avevo iniziato così...

<asp:datagrid id="dgCarrello" BorderWidth="0px" AutoGenerateColumns="False" AllowPaging="True"
AllowCustomPaging="True" AllowSorting="True" CellPadding="2" PageSize="5" Width="603px" BorderColor="#4286cd"
runat="server" BackColor="#E4EEF8" OnPageIndexChanged="saltapagina" OnItemCommand="dgCarrello_ItemCommand" OnItemCreated="VedoPrendi">
...........................
<ItemTemplate>
...........................
<asp:Button id="btPrendi" runat="server" Text="Prendi" CommandName="Prendi" CssClass="t11" visible=false/>
<hr>
</ItemTemplate>
...........................
nel codebehind..............
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.UI.WebControls
Imports System.Web.UI.TemplateControl
Imports Microsoft.VisualBasic
Public Class risorse : Inherits System.Web.UI.Page

Public lbPaginazione As Label
Public lbErrore As Label
Public lbId As Label
Public lbPrezzo As Label
Public cbCU As CheckBox
Public btprendi As Button
..................................
Sub VedoPrendi(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If Not Session("idutente") Is Nothing Then
CType(e.Item.FindControl("btPrendi"), Button).Visible = True
End If
End Sub
ma mi restituisce quest'errore:
System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto , sul ctype ecc...

Io credo che il problema si verifichi perchè quando ad esempio faccio una modifica ne ho uno di elemento a cui far riferimento invece qui ho tanti bottoni, uno per riga... forse....
come posso risolvere?

grazie,
Elisa