gridview排序以后,每行数据就变成了两行,帮忙看看怎么回事!!
Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
conn.Open()
comm = New OdbcCommand("select * from [" & DropDownList1.SelectedItem.Text & "$]", conn)
dr = comm.ExecuteReader
dt.Load(dr)
dt.DefaultView.Sort = e.SortExpression & " " & GetSortDirection(e.SortExpression)
GridView1.DataSource = dt
GridView1.DataBind()
conn.Close()
End Sub
------解决方案--------------------
你的 dt 不是保存在 Session 里吧。那就没必要再次查询了。
要么就重新 New 一个。