K
Kim Quigley
I have a datagrid with a template column and in that column I have some
label controls and an image button. The image button causes the
Products_ItemCommand event to fire; however, the value of ItemID is "".
Can anyone explain why this is so and how to get around it? Thanks!
HTML:
<asp:Label id="ItemIDLabel" runat="server" text='<%#
Container.DataItem("ItemID")%>'></asp:Label>
CODE BEHIND:
Private Sub Products_ItemCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
Products.ItemCommand
If (e.CommandName = "AddToCart") Then
'Add to cookie
Dim ItemID As Label
ItemID = CType(e.Item.Cells(0).FindControl("ItemIDLabel"),
Label)
Response.Write(ItemID)
End If
End Sub
label controls and an image button. The image button causes the
Products_ItemCommand event to fire; however, the value of ItemID is "".
Can anyone explain why this is so and how to get around it? Thanks!
HTML:
<asp:Label id="ItemIDLabel" runat="server" text='<%#
Container.DataItem("ItemID")%>'></asp:Label>
CODE BEHIND:
Private Sub Products_ItemCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
Products.ItemCommand
If (e.CommandName = "AddToCart") Then
'Add to cookie
Dim ItemID As Label
ItemID = CType(e.Item.Cells(0).FindControl("ItemIDLabel"),
Label)
Response.Write(ItemID)
End If
End Sub