Button column event not firing

D

Dale

I just edited about 12 DataGrids on as many pages to update the look and feel
to current company standards. One thing I did was replace LinkButtons with
PushButtons. On all of the DataGrids, I simply edited the Text attribute to
the current requirement and then added a ButtonType=PushButton attribute.

On the first 11, this worked flawlessly. On the very last one, it bombed.
The PushButton would post back but no event handler would be called. The
CommandName attribute of the buttons is "Cancel" yet neither the ItemCommand
nor the CancelCommand event would fire. Form["__EVENTTARGET"] and
Form["__EVENTARGUMENT"] are both null.

All I had to do is take out the ButtonType=PushButton attribute and the
events would fire as expected.

This code works:

<asp:datagrid id="flagList" runat="server" AutoGenerateColumns="False"
AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#CFCFCF"
HeaderStyle-ForeColor="black" HeaderStyle-Font-Bold="True"
OnItemDataBound="flagList_ItemDataBound" CellPadding="3" Font-Size="X-Small"
DataKeyField="name" BorderColor="DarkGray">
<Columns>
<asp:ButtonColumn Text="<img src=images/cancel.gif border=0 alt='Cancel'>"
HeaderText="Cancel Job" CommandName="Cancel">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>

And this code does not (The datagrid declaration is the same as above so I
am only showing the different ButtonColumn declaration):

<asp:ButtonColumn Text="Cancel" HeaderText="Cancel Job" CommandName="Cancel">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>

If I have both versions in the code, the original version still works and
the PushButton version does not work.

Any suggestions?

Thanks,

Dale
 
W

Walter Wang [MSFT]

Hi Dale,

From the two versions of the code, I can the difference is the Text
property changed from an image tag to "Cancel", I didn't see the
ButtonType="PushButton" in new version.

Based on your other description, I guess the question is after you changed
the ButtonType from default "LinkButton" to "PushButton", the button
command failed to function correctly, right?

I've done some simple test using Visual Studio 2005 and didn't found the
issue you mentioned, also you've mentioned that other 11 DataGrid work, so
I think I might have to use a more complete webform to test that behavior
on my side. Is it possible to create a reproducible web project and send it
to me? Thank you for your effort and understanding.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Dale

Sorry about the confusion. In editing the "non-working" code format to
display in this forum, I accidentally dropped the ButtonType="PushButton"
attribute but it does exist in the problem application.

When I get back to work, I will see if I can create the problem in a simple
application. As I said, since the same code worked in several pages and
several datagrids, I am not sure what will happen.

Thanks for the response and you should hear from me again by Monday.

Dale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top