DataGrid OnSortCommand event not firing for some data

E

Edo van Vliet

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top