Link to home
Start Free TrialLog in
Avatar of bjohns33
bjohns33

asked on

Being stupid - ItemCommand trigger not firing

When clicking on my commands in my datagrid, the ItemCommand is not getting fired

Item command in c#:
private void dgDocList_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
      //Get the document id of the selected document and store in viewstate.
      _docId = int.Parse(e.Item.Cells[0].Text);
      ViewState["docId"] = _docId;

      switch(e.CommandName)
      {                        
      case "Copy":
      break;
      case "Delete":
      DeleteDocument();
      break;
      case "Edit":
      EditDocument();
      break;      
      case "More":
      break;      
      default:
      // Do nothing.
      break;
      }      
}

First part of ASP code:
<asp:DataGrid id="dgDocList" runat="server" Width="747px" AutoGenerateColumns="False">
<AlternatingItemStyle CssClass="altItemStyle"></AlternatingItemStyle>
<ItemStyle CssClass="itemStyle"></ItemStyle>
<HeaderStyle CssClass="headerStyle"></HeaderStyle>
<Columns>
<asp:BoundColumn Visible="False" DataField="Document_ID">
<ItemStyle Width="1px"></ItemStyle>
</asp:BoundColumn>
<asp:ButtonColumn Text="Edit" CommandName="Edit" ItemStyle-Width="30px"></asp:ButtonColumn>
                        
Any ideas?  I've set a break point on the ItemCommand function and it's never reached.

This has to be something obvious that I'm missing, I'm sure, as I have this functionality working in other projects, and to my eye they don't look any different.

TIA
Ben
ASKER CERTIFIED SOLUTION
Avatar of zulu_11
zulu_11

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bjohns33
bjohns33

ASKER

Thanks Zulu, that was it - it's always something simple isn't!