<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