H
Harley
I have a Template column with 2 imagebuttons and 1 linkbutton.
The OnItemCommand handler defined on the DataGrid control is not fired when
I click the imagebuttons, but works perfectly with the linkbutton.
I'm posting the code so someone can take a look and hopelfully has an idea
of what I'm doing wrong. Thank you!
PS: the dtagagrid is on a UserControl, i'm posting the code for the user
control.
PS2: to wire the handler, I used both approaches, via HTML OnItemCommand
defined on the datagrid's HTML code and I added a "Handles
controlName.ItemCommand" to the OnItemCommand handler signature on the VB
code.
PS3: note the CommandName and CommandArgument defined for each control.
ctrlPending.ascx
-------------------
<asp:datagrid id="dtgPendientes" runat="server" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3"
AllowSorting="True" AutoGenerateColumns="False"
OnItemCommand="dtgPendientes_Procesar">
.......
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton id=imbDetail runat="server" Tooltip="Ver Detalle"
CommandArgument='<%# Container.DataItem("in_tkt_code")%>'
CommandName="Detail" Width="16px" Height="16px"
ImageUrl="../images/interface/ico_view.gif"></asp:ImageButton>
<asp:ImageButton id=imbClose runat="server" Tooltip="Cancelar Incidente"
CommandArgument='<%# Container.DataItem("in_tkt_code")%>' CommandName="Close"
Width="16px" Height="16px"
ImageUrl="../images/interface/ico_cancel.gif"></asp:ImageButton>
<asp:LinkButton id="LinkButton1" runat="server" CommandArgument='<%#
Container.DataItem("in_tkt_code")%>'
CommandName="Detail">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
ctrlPending.ascx.vb (the code behind for the control)
The OnItemCommand handler defined on the DataGrid control is not fired when
I click the imagebuttons, but works perfectly with the linkbutton.
I'm posting the code so someone can take a look and hopelfully has an idea
of what I'm doing wrong. Thank you!
PS: the dtagagrid is on a UserControl, i'm posting the code for the user
control.
PS2: to wire the handler, I used both approaches, via HTML OnItemCommand
defined on the datagrid's HTML code and I added a "Handles
controlName.ItemCommand" to the OnItemCommand handler signature on the VB
code.
PS3: note the CommandName and CommandArgument defined for each control.
ctrlPending.ascx
-------------------
<asp:datagrid id="dtgPendientes" runat="server" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3"
AllowSorting="True" AutoGenerateColumns="False"
OnItemCommand="dtgPendientes_Procesar">
.......
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton id=imbDetail runat="server" Tooltip="Ver Detalle"
CommandArgument='<%# Container.DataItem("in_tkt_code")%>'
CommandName="Detail" Width="16px" Height="16px"
ImageUrl="../images/interface/ico_view.gif"></asp:ImageButton>
<asp:ImageButton id=imbClose runat="server" Tooltip="Cancelar Incidente"
CommandArgument='<%# Container.DataItem("in_tkt_code")%>' CommandName="Close"
Width="16px" Height="16px"
ImageUrl="../images/interface/ico_cancel.gif"></asp:ImageButton>
<asp:LinkButton id="LinkButton1" runat="server" CommandArgument='<%#
Container.DataItem("in_tkt_code")%>'
CommandName="Detail">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
ctrlPending.ascx.vb (the code behind for the control)