GridView的数据排序代码如下:
if (ViewState["Order"] == null)
{
ViewState["Oeder"] = "ASC";
}
else
{
if (ViewState["Oeder"].ToString() == "ASC")
{
ViewState["Oeder"] = "DESC";
}
else
{
ViewState["Order"] = "ASC";
}
}
//数据绑定显示
SqlConnection con = new SqlConnection("server=.;database=login;uid=sa;pwd=;");
con.Open();
SqlDataAdapter sdr = new SqlDataAdapter();
sdr.SelectCommand = new SqlCommand("select * from login", con);
DataSet ds = new DataSet();
sdr.Fill(ds, "userName");
ds.Tables["userName"].DefaultView.Sort = e.SortExpression + " " + ViewState["Order"].ToString();
this.GridView1.DataSource = ds.Tables["userName"].DefaultView;
this.GridView1.DataBind();
运行时提示错误:System.EventArgs”并不包含“SortExpression”的定义,请问那里错了???