473,473 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Bug in DataGrid - ItemCommand event does not fire for ButtonColumnif ButtonType="PushButton"

We have a Datagrid which contains a template column with a button in it,
as well as an actual button column. If either of the buttons are
clicked, the ItemCommand event does not fire.

If however, the ButtonType of the ButtonColumn is changed to
"LinkButton" instead of "PushButton", the event fires normally!

Why on earth is this happening? I presume this a bug in .NET? (We are
using 1.1 final).

<asp:DataGrid id="JobsDataGrid" runat="server"
AutoGenerateColumns="False"
DataKeyField="JobNumber" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button ID="RunJobButton" Runat="server"
CommandName="RunJob"
CommandArgument="1"
Text="Run Task 1" />
</ItemTemplate>

</asp:TemplateColumn>
<asp:ButtonColumn ButtonType="PushButton" CommandName="RunJob"
Text="Run Task 2" />
</Columns>
</asp:DataGrid>

Any ideas how to fix this would be appeciated.

Nick...
Nov 18 '05 #1
2 2011
You might not be handling PostBack in the Page Load
Try adding the statements
if not Page.IsPostback then
'your code
end if

"Nick Gilbert" <ne**@nickgilbert.com> wrote in message news:u0**************@tk2msftngp13.phx.gbl...
We have a Datagrid which contains a template column with a button in it,
as well as an actual button column. If either of the buttons are
clicked, the ItemCommand event does not fire.

If however, the ButtonType of the ButtonColumn is changed to
"LinkButton" instead of "PushButton", the event fires normally!

Why on earth is this happening? I presume this a bug in .NET? (We are
using 1.1 final).

<asp:DataGrid id="JobsDataGrid" runat="server"
AutoGenerateColumns="False"
DataKeyField="JobNumber" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button ID="RunJobButton" Runat="server"
CommandName="RunJob"
CommandArgument="1"
Text="Run Task 1" />
</ItemTemplate>

</asp:TemplateColumn>
<asp:ButtonColumn ButtonType="PushButton" CommandName="RunJob"
Text="Run Task 2" />
</Columns>
</asp:DataGrid>

Any ideas how to fix this would be appeciated.

Nick...


Nov 18 '05 #2

Hi Nick,

I found that this post has been posted in several groups. I have added a
reply to you in microsoft.public.dotnet.framework.aspnet.datagridc ontrol.
Please follow up there, I will work with you.
Thanks for your understanding,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #3

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

Similar topics

1
by: Mike | last post by:
I have a DataGrid that I am binding to a DataSet. I am adding a button to the DataGrid for users to retrieve additional information about that record. The problem I have is that the ItemCommand...
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...
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...
3
by: Jimmy | last post by:
Hi, I built a webform with a repeater: <asp:repeater id="rep1" runat="server" DataSource='<%# ar %>'> <ItemTemplate> <asp:Button Runat=server Text="<%# Container.DataItem %>" ID="Button1"...
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: Steve | last post by:
Looking for some help on this one... I have three servers (development, staging, production), each running the same code. All three computers are running Windows 2003 Server, IIS 6.0. I have...
1
by: orangedesk | last post by:
Please let me know what all options can I try to make the itemcommand get called when a image button gets clicked? I tried some of the options like checking the autopost back before binding the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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: 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: 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.