P
Peter O'Reilly
The DataGridSortCommandEventHandler event will *not* fire unless I *also*
bind data to the datagrid event in the page load event.
Very strange!!!
Needless to say making two trips to the database to perform a sort is very
inefficient. I've used sorting for other datagrids in other projects and
this databinding, take 2 was never necessary.
private void Page_Load(object sender, System.EventArgs e)
{
// if(!Page.IsPostBack) -- must be commented out for SortRequest event
to fire
PopulateGrid(txtSortByColumn.Value);
}
private void dataGrid_SortRequest(object sender,
System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
this.PopulateGrid(e.SortExpression);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.dataGrid.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.dataGrid_Sort
Request);
}
bind data to the datagrid event in the page load event.
Very strange!!!
Needless to say making two trips to the database to perform a sort is very
inefficient. I've used sorting for other datagrids in other projects and
this databinding, take 2 was never necessary.
private void Page_Load(object sender, System.EventArgs e)
{
// if(!Page.IsPostBack) -- must be commented out for SortRequest event
to fire
PopulateGrid(txtSortByColumn.Value);
}
private void dataGrid_SortRequest(object sender,
System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
this.PopulateGrid(e.SortExpression);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.dataGrid.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.dataGrid_Sort
Request);
}