Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > OnItemCommand not working with ImageButton and OK with LinkButton

Reply
Thread Tools

OnItemCommand not working with ImageButton and OK with LinkButton

 
 
Harley
Guest
Posts: n/a
 
      09-14-2004
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)
-----------------------
Sub dtgPendientes_Procesar(ByVal objSender As Object, ByVal objArgs As
DataGridCommandEventArgs) Handles dtgPendientes.ItemCommand
........
End Sub



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ImageButton and LinkButton does not render MichiMichi ASP .Net 0 05-29-2007 04:37 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net 3 09-08-2005 09:41 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net Datagrid Control 1 09-08-2005 08:44 AM
Button/LinkButton/ImageButton... should inherit from common base? Andrew Backer ASP .Net Web Controls 0 03-15-2005 11:38 PM
datagrid OnItemCommand handler not executing Rick White ASP .Net 1 01-13-2004 05:41 AM



Advertisments