DataGrid OnSortCommand event not firing for some data

Discussion in 'ASP .Net Datagrid Control' started by Edo van Vliet, Jun 22, 2004.

  1. Ok, I have a problem :)

    I have a derived datagrid:

    public class FlexGrid : System.Web.UI.WebControls.DataGrid,
    INamingContainer)

    This contains the usual makeup things, plus three button columns(view,
    edit, delete) and a sort event:

    SortCommand += new DataGridSortCommandEventHandler(OnSortCommand);
    The OnSortCommand sets some sorting info (using a dataview) and call
    the grids databind()

    The page has an instance of this grid and retrieves the data:

    private void Page_Load(object sender, System.EventArgs e)
    {
    DataSet ds = serv.GetFootnotesList();
    mygrid.DataSource = ds.Tables[0];

    if (!IsPostBack)
    {
    mygrid.DataBind();
    }
    }

    So far so good. When the page is loaded the grid is displayed.
    Clicking a header does a postback, the data is re-retrieved (but the
    databind in the page_load is not fired), the grids OnSortCommand
    fires, which does the final databind.

    This all works! But, when changing the datasource to include any
    variable, the first click on an header does NOT fire the
    OnSortCommand:

    private void Page_Load(object sender, System.EventArgs e)
    {
    int ID = int.Parse(Request.Querystring["id"]);
    DataSet ds = serv.GetFootnotesList(ID);
    mygrid.DataSource = ds.Tables[0];

    if (!IsPostBack)
    {
    mygrid.DataBind();
    }
    }

    Digging further, no events are fired what so ever (the first time) in
    this scenario! No buttoncolumn click or paging click. Does anyone have
    any clue?

    -Edo van Vliet.
    I can be reached at: vliet (atsign) bba (dot) nl
     
    Edo van Vliet, Jun 22, 2004
    #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. =?Utf-8?B?QXNoYQ==?=
    Replies:
    0
    Views:
    417
    =?Utf-8?B?QXNoYQ==?=
    Jan 20, 2005
  2. Chad Devine
    Replies:
    2
    Views:
    3,628
    slickuser
    Feb 6, 2008
  3. =?Utf-8?B?ZGFuYw==?=

    DataGrid ItemCommand event not firing if not first page

    =?Utf-8?B?ZGFuYw==?=, Oct 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,180
    =?Utf-8?B?ZGFuYw==?=
    Oct 26, 2005
  4. JT
    Replies:
    0
    Views:
    704
  5. Anthony Papillion

    TkInter bind() event is not firing event trigger

    Anthony Papillion, Jun 23, 2010, in forum: Python
    Replies:
    3
    Views:
    1,789
    rantingrick
    Jun 23, 2010
Loading...

Share This Page