ItemCommand does not fire

Discussion in 'ASP .Net Datagrid Control' started by thijs braem via .NET 247, May 15, 2005.

  1. hi, this problem is driving me nuts:

    My page contains a dynamically built datagrid, which in turncontains a ButtonColumn meant to allow the user to edit aparticular record in a new detail page.
    Now, no matter what I try, the ItemCommand event never getsfired. I found on other messageboards tips to add an invisiblebound column, turn on or off the viewstate for the datagrid, oruse a pushbutton instead of a linkbutton, but none of thathelped a thing.

    Is this a bug, or did I miss something here? Please say so if Ididn't provide enough information...

    //THE BUTTON COLUMN THAT IS ADDED TO THE DATAGRID
    ButtonColumn bclEditView = new ButtonColumn();
    bclEditView.ButtonType =System.Web.UI.WebControls.ButtonColumnType.PushButton;
    bclEditView.CommandName = "EditView";
    bclEditView.Text = "Edit/View";
    bclEditView.HeaderText = "Edit/View";

    //INITIALIZECOMPONENT
    private void InitializeComponent()
    {
    this.btnNewRequest.Click += newSystem.EventHandler(this.btnNewRequest_Click);
    this.dgrAll.ItemCommand += newSystem.Web.UI.WebControls.DataGridCommandEventHandler(this.dgrAll_ItemCommand);
    this.dgrAll.SelectedIndexChanged += newSystem.EventHandler(this.dgrAll_SelectedIndexChanged);
    this.Load += new System.EventHandler(this.Page_Load);
    }

    //WHAT SHOULD HAPPEN WHEN A BUTTON IS CLICKED (debugger nevergets here...)
    private void dgrAll_ItemCommand(Object sender,DataGridCommandEventArgs e)
    {
    this.AddResponseLine("button clicked!");
    }


    thanks for any response,
    thijs

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>8pN4Hz0kME2c7bHObEu8QQ==</Id>
    thijs braem via .NET 247, May 15, 2005
    #1
    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. Nick Gilbert
    Replies:
    2
    Views:
    875
    Jeffrey Tan[MSFT]
    Dec 15, 2003
  2. Replies:
    3
    Views:
    2,632
    Karl Seguin
    Feb 7, 2005
  3. Jimmy
    Replies:
    3
    Views:
    3,913
    Jimmy
    May 28, 2005
  4. Nick Gilbert
    Replies:
    4
    Views:
    236
    Jeffrey Tan[MSFT]
    Dec 16, 2003
  5. Krushna

    Repeater ItemCommand does not fire the first time

    Krushna, Jul 29, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    171
    Krushna
    Jul 29, 2005
Loading...

Share This Page