473,473 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Triggering ItemCommand with ImageButton in Datagrid

Hi

I had a Delete Column in a datagrid that was a Linkbutton. That needed to
change into a ImageButton because of the design demands in the project. Then
how do I trigger the DeleteCommand with that button?

I don't want to have to add a AddHandler in the ItemCreated or ItemDataBound
for this ImageButton cause then I can't get the ID from the Row to delete as
easy...

please help/
Lars Netzel
Nov 19 '05 #1
2 3227
Specify the ImageButton with CommandName="Delete" attribute.

<asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" .../>

CommandNames Cancel, Delete, Edit, NextPage, Page, PrevPage, Select, Sort
and Update correspond to the same action with the DataGrid (DataGrid has
these command names predefined for cthese actions)

See docs for further details.

--
Teemu Keiski
ASP.NET MVP, Finland

"Lars Netzel" <ui****@adf.se> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi

I had a Delete Column in a datagrid that was a Linkbutton. That needed to
change into a ImageButton because of the design demands in the project.
Then how do I trigger the DeleteCommand with that button?

I don't want to have to add a AddHandler in the ItemCreated or
ItemDataBound for this ImageButton cause then I can't get the ID from the
Row to delete as easy...

please help/
Lars Netzel

Nov 19 '05 #2
Ah, stupid me:) I wrote ItemCommand instead of CommandName... thx

/Lars
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
Specify the ImageButton with CommandName="Delete" attribute.

<asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" .../>

CommandNames Cancel, Delete, Edit, NextPage, Page, PrevPage, Select, Sort
and Update correspond to the same action with the DataGrid (DataGrid has
these command names predefined for cthese actions)

See docs for further details.

--
Teemu Keiski
ASP.NET MVP, Finland

"Lars Netzel" <ui****@adf.se> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi

I had a Delete Column in a datagrid that was a Linkbutton. That needed to
change into a ImageButton because of the design demands in the project.
Then how do I trigger the DeleteCommand with that button?

I don't want to have to add a AddHandler in the ItemCreated or
ItemDataBound for this ImageButton cause then I can't get the ID from the
Row to delete as easy...

please help/
Lars Netzel


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Solomon Shaffer | last post by:
I am trying to add some link buttons to a datagrid template column at runtime and trying to wire these buttons up to the ItemCommand event (or any event when clicked!). The ItemCommand event works...
0
by: Mark Kelly | last post by:
(originally posted on framework.aspnet.datagridcontrol) Hi, I don't seem to be able to get a imagebutton (within a template column) to fire an itemcommand event when clicked. Looking through this...
0
by: Sparhawk | last post by:
I got a weird problem with a repeater. The Repeater has an ImageButton in its ItemTemplate. The Repeater has an ItemCommand defined. If the user clicks one of the buttons, nothing happens. If...
2
by: Syed Sami R. Shah | last post by:
hi all, i am having problem with using itemcommand of datagrid by way of asp:image button. i have put an image button in a datagrid item template and have set CommandName="DeleteRecord" and have...
2
by: Deepesh | last post by:
Good day, I have a specific case of the DataGrid in my solution which is causing the ItemCommand Event Not Firing. So I'm creating a "Skinnable" set of controls. I seperate the actual ASCX file...
4
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up ...
3
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not...
1
by: Adam Knight | last post by:
Hi all, I have a datagrid like so: <asp:datagrid id="dgContractors" OnItemCommand="dgContractor_ItemCommand" Runat="server" Width="920"> Shortened for brevity..
2
by: Nathan Sokalski | last post by:
I have an ImageButton inside a Repeater control. However, the ImageButton does not trigger the Repeater's ItemCommand event. For the moment, I am nesting an Image control inside a LinkButton, which...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.