Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > DataGrid OnSortCommand event not firing for some data

Thread Tools

DataGrid OnSortCommand event not firing for some data

Edo van Vliet
Posts: n/a
Ok, I have a problem

I have a derived datagrid:

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

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)

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

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)

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
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
TkInter bind() event is not firing event trigger Anthony Papillion Python 3 06-23-2010 12:55 AM
Dynamic Bound Columns OnSortCommand not called (Solution) Chad Devine ASP .Net 2 02-06-2008 06:04 PM
"System.Web.HttpException: External component has thrown an exception" if OnSortCommand attribute is present in a datagrid control JT ASP .Net 0 11-10-2006 06:07 AM
DataGrid ItemCommand event not firing if not first page =?Utf-8?B?ZGFuYw==?= ASP .Net 3 10-26-2005 05:24 PM
Can onitemcommand be together with onsortcommand on the same grid? =?Utf-8?B?QXNoYQ==?= ASP .Net 0 01-20-2005 03:29 AM