Button column event not firing

Discussion in 'ASP .Net Datagrid Control' started by Dale, Oct 26, 2006.

  1. Dale

    Dale Guest

    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
    --
    Dale Preston
    MCAD C#
    MCSE, MCDBA
    Dale, Oct 26, 2006
    #1
    1. Advertising

  2. 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 (, 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.
    Walter Wang [MSFT], Oct 27, 2006
    #2
    1. Advertising

  3. Dale

    Dale Guest

    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
    --
    Dale Preston
    MCAD C#
    MCSE, MCDBA


    "Walter Wang [MSFT]" wrote:

    > 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 (, 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, Oct 28, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Max
    Replies:
    3
    Views:
    688
  2. Ken Cox [Microsoft MVP]

    Button Click event not firing

    Ken Cox [Microsoft MVP], Apr 28, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,526
    Andrea Williams
    Apr 28, 2004
  3. carlos perez
    Replies:
    0
    Views:
    406
    carlos perez
    Jun 8, 2004
  4. GauravGupta
    Replies:
    4
    Views:
    2,086
    Shilpa1234
    Jan 19, 2012
  5. Allen S

    Datagrid Button Column not Firing in Panel Control

    Allen S, Nov 15, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    171
    Allen S
    Nov 15, 2004
Loading...

Share This Page