SortExpression makes SortCommand event not to trig

Discussion in 'ASP .Net' started by =?Utf-8?B?UGF1bA==?=, Sep 22, 2005.

  1. Hi!

    When I add a bound column programatically, like:

    BoundColumn bc = new BoundColumn();
    bc.DataField = "myField";
    bc.SortExpression = "myField";
    myGrid.Columns.Add(bc);

    the SortCommand event does not trig at all!

    If I replace the code whith the markup syntax in the ascx file, it works
    fine. I've google around but the only solution to the problem seemes to be
    moving the code to Page_Init.

    This is not possible because at that time I dont know the structure of the
    table. Depending on a selection in a dropdown, i get diffrent datatables to
    bind with the grid. The selectedindexchanged event on the dropdown will not
    fire until much later in execution, so in Page_Init I wouldn't know what was
    selected yet. Furthermore i cant understand what Page_Init has to do with all
    of this.

    I'm confused, any ideas?

    Thanks,
    Paul
    =?Utf-8?B?UGF1bA==?=, Sep 22, 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. John Sturgeon

    DataGrid SortCommand event not triggered

    John Sturgeon, Nov 26, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    578
    John Sturgeon
    Dec 2, 2003
  2. =?Utf-8?B?UGF1bA==?=

    Setting SortExpression programmatically

    =?Utf-8?B?UGF1bA==?=, Sep 26, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    6,000
    Kalpesh
    Sep 27, 2005
  3. 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:
    155
    Cole Trickle
    May 5, 2005
  4. ae
    Replies:
    2
    Views:
    122
    venuprs
    Apr 8, 2005
  5. biru
    Replies:
    2
    Views:
    229
Loading...

Share This Page