Column sorting not working in GridView

  • Thread starter Thread starter Thirsty Traveler
  • Start date Start date
T

Thirsty Traveler

I have a web page with a few textboxes used for filtering a read-only result
set to a GridView. I am unable to get the ObjectDataSource binding to work
as desired insofar as it returns a resultset on page load prior to the
filter requests for the query, so I am doing a dynamic binding to the
returned DataSet after a call to the business logic layer. It seems to work,
but I am unable to sort on the column headings even though I have set the
Sort Expression. Is it because of the late binding?

My code snippet is as follows:

protected void Search_Click(object sender, ImageClickEventArgs e)
{
string conn =
ConfigurationManager.ConnectionStrings["tst"].ConnectionString;
TSTBLL bll = new TSTBLL ();
TSTBE mt = bll.SubmitQuery(tbJobName.Text, tbOrderDateFrom.Text,
tbOrderDateTo.Text, conn);
GridView1.DataSource = mt.Test_Table;
GridView1.DataBind();
}
 
This is close... however, my GridView.DataSource is returning as null in the
sorting event.
 
Back
Top