ItemCommand firing instead of SortCommand

Discussion in 'ASP .Net Datagrid Control' started by Steven, Oct 24, 2003.

  1. Steven

    Steven Guest

    Hi there,

    I am having a weird problem. I have a datagrid with both an ItemCommand and
    a SortCommand. It was working fine until a day ago. Now, whenever I click
    a column to fire the SortCommand, the ItemCommand gets fired instead. In
    the debugger, e.CommandName is equal to "Sort", even though it is being
    handled by the ItemCommand event. If I remove the ItemCommand event
    handler, it works fine, but as soon as I put it back in the same problem
    occurs.

    Any ideas would be greatly appreciated.

    Thanks,

    Steven
     
    Steven, Oct 24, 2003
    #1
    1. Advertising

  2. Steven

    Alvin Bruney Guest

    the problem will lie in your initialize component section. It is daizy
    chained to the wrong event. you can either re-chain it in code to the right
    handler or use the property grid object event section to re-map the handler.
    hth

    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits
    "Steven" <> wrote in message
    news:...
    > Hi there,
    >
    > I am having a weird problem. I have a datagrid with both an ItemCommand

    and
    > a SortCommand. It was working fine until a day ago. Now, whenever I

    click
    > a column to fire the SortCommand, the ItemCommand gets fired instead. In
    > the debugger, e.CommandName is equal to "Sort", even though it is being
    > handled by the ItemCommand event. If I remove the ItemCommand event
    > handler, it works fine, but as soon as I put it back in the same problem
    > occurs.
    >
    > Any ideas would be greatly appreciated.
    >
    > Thanks,
    >
    > Steven
    >
    >
     
    Alvin Bruney, Oct 24, 2003
    #2
    1. Advertising

  3. Steven

    Alvin Bruney Guest

    Oh sorry, itemcommand fires first and then sortcommand fires after. If you
    put a break point in your sort command, it will/should eventually fire. I'd
    be happy to take a closer look if this doesn't work for you.

    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits
    "Steven" <> wrote in message
    news:...
    Looks fine to me...

    private void InitializeComponent()

    {
    this.productsGrid.ItemCommand += new
    System.Web.UI.WebControls.DataGridCommandEventHandler(this.productsGrid_Item
    Command);
    this.productsGrid.PageIndexChanged += new
    System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.productsGrid_
    PageIndexChanged);
    this.productsGrid.SortCommand += new
    System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.productsGrid_
    SortCommand);
    this.Load += new System.EventHandler(this.Page_Load);

    }

    "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com> wrote in
    message news:%23ll%...
    > the problem will lie in your initialize component section. It is daizy
    > chained to the wrong event. you can either re-chain it in code to the

    right
    > handler or use the property grid object event section to re-map the

    handler.
    > hth
    >
    > --
    >
    >
    > -----------
    > Got TidBits?
    > Get it here: www.networkip.net/tidbits
    > "Steven" <> wrote in message
    > news:...
    > > Hi there,
    > >
    > > I am having a weird problem. I have a datagrid with both an ItemCommand

    > and
    > > a SortCommand. It was working fine until a day ago. Now, whenever I

    > click
    > > a column to fire the SortCommand, the ItemCommand gets fired instead.

    In
    > > the debugger, e.CommandName is equal to "Sort", even though it is being
    > > handled by the ItemCommand event. If I remove the ItemCommand event
    > > handler, it works fine, but as soon as I put it back in the same problem
    > > occurs.
    > >
    > > Any ideas would be greatly appreciated.
    > >
    > > Thanks,
    > >
    > > Steven
    > >
    > >

    >
    >
     
    Alvin Bruney, Oct 25, 2003
    #3
  4. Steven

    Steven Guest

    Ahh. That solves the problem. Thanks!

    "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com> wrote in
    message news:ux%...
    > Oh sorry, itemcommand fires first and then sortcommand fires after. If you
    > put a break point in your sort command, it will/should eventually fire.

    I'd
    > be happy to take a closer look if this doesn't work for you.
    >
    > --
    >
    >
    > -----------
    > Got TidBits?
    > Get it here: www.networkip.net/tidbits
    > "Steven" <> wrote in message
    > news:...
    > Looks fine to me...
    >
    > private void InitializeComponent()
    >
    > {
    > this.productsGrid.ItemCommand += new
    >

    System.Web.UI.WebControls.DataGridCommandEventHandler(this.productsGrid_Item
    > Command);
    > this.productsGrid.PageIndexChanged += new
    >

    System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.productsGrid_
    > PageIndexChanged);
    > this.productsGrid.SortCommand += new
    >

    System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.productsGrid_
    > SortCommand);
    > this.Load += new System.EventHandler(this.Page_Load);
    >
    > }
    >
    > "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com> wrote in
    > message news:%23ll%...
    > > the problem will lie in your initialize component section. It is daizy
    > > chained to the wrong event. you can either re-chain it in code to the

    > right
    > > handler or use the property grid object event section to re-map the

    > handler.
    > > hth
    > >
    > > --
    > >
    > >
    > > -----------
    > > Got TidBits?
    > > Get it here: www.networkip.net/tidbits
    > > "Steven" <> wrote in message
    > > news:...
    > > > Hi there,
    > > >
    > > > I am having a weird problem. I have a datagrid with both an

    ItemCommand
    > > and
    > > > a SortCommand. It was working fine until a day ago. Now, whenever I

    > > click
    > > > a column to fire the SortCommand, the ItemCommand gets fired instead.

    > In
    > > > the debugger, e.CommandName is equal to "Sort", even though it is

    being
    > > > handled by the ItemCommand event. If I remove the ItemCommand event
    > > > handler, it works fine, but as soon as I put it back in the same

    problem
    > > > occurs.
    > > >
    > > > Any ideas would be greatly appreciated.
    > > >
    > > > Thanks,
    > > >
    > > > Steven
    > > >
    > > >

    > >
    > >

    >
    >
     
    Steven, Oct 25, 2003
    #4
    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. EatHam

    SortCommand not firing

    EatHam, Jan 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    588
    EatHam
    Jan 21, 2004
  2. Ken Tucker
    Replies:
    2
    Views:
    2,581
    Ken Tucker
    Jul 6, 2003
  3. Steven
    Replies:
    4
    Views:
    1,586
    Steven
    Oct 25, 2003
  4. Ken Tucker

    DataGrid SortCommand not firing using code-behind??

    Ken Tucker, Jul 5, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    215
    Ken Tucker
    Jul 6, 2003
  5. sa siva via .NET 247

    SortCommand and PageIndexChange event not firing

    sa siva via .NET 247, Mar 24, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    174
    Cole Trickle
    May 5, 2005
Loading...

Share This Page