Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / October 2006

Tip: Looking for answers? Try searching our database.

Button column event not firing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dale - 26 Oct 2006 17:29 GMT
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
Signature

Dale Preston
MCAD C#
MCSE, MCDBA

Walter Wang [MSFT] - 27 Oct 2006 04:51 GMT
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 (wawang@online.microsoft.com, 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.
Dale - 28 Oct 2006 18:57 GMT
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
Signature

Dale Preston
MCAD C#
MCSE, MCDBA

> Hi Dale,
>
[quoted text clipped - 37 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.