public void product_list_Sort(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{

ViewState["SortExpression"]=e.SortExpression;//获取表达式
if ((string)ViewState["orderby"]=="asc")
ViewState["orderby"]="desc";
else
ViewState["orderby"]="asc";
             
BindGrid(); }
void BindGrid() 
{

SelectCommand="select a.*,b.name as classname,c.name as tradeclassname from Product_List a,Product_Class b,Trade_Apply_Small_Class c where a.Product_Class_ID=b.Product_Class_ID and a.Trade_Apply_Small_Class_ID=c.Trade_Apply_Small_Class_ID and a.isvalid=0";
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlDataAdapter myCommand = new SqlDataAdapter(SelectCommand, myConnection);
            DataSet ds = new DataSet();
myCommand.Fill(ds,"Product_List");
DataView dv = ds.Tables["Product_List"].DefaultView;
  
// sort the view according to the value stored in the ViewState, in any
if (ViewState["SortExpression"] != null)
dv.Sort = ViewState["SortExpression"].ToString()+" "+ViewState["orderby"];   product_list.DataSource = dv;
product_list.DataBind();    
}
这是一个排序的后台代码,为什么我点击标题排序只能排一次,再点击还是原来的效果??