i am using asp.net (VB), and Access Database
i make the connection and make a datagrid from the OleDbAdaptor
I tick "allow sorting" and enter "colName asc" as sort expression the
property builder of the datagrid
i want to use the "dataview" approach to sort the columns
if i add "if not me.ispostback", nothing will be loaded after click the
column head
if not add, the column will give no response even i click the column head
thanks a lot!
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
datgrid1.DataBind()
End Sub
in Sort_Command event handler
Dim SortView As DataView = DataSet11.Products.DefaultView
SortView.Sort = e.SortExpression
DataGrid1.DataSource = SortView
DataGrid1.DataBind()
"Sachi" wrote:
I am not sure how your entire code look like.
I suggest you to take a look at this small example in below article.
http://www.dotnetjunkies.com/Article...0D57699C3.dcik
Sachi
"alan" wrote:
I set the datagrid to be sortable,
sort expression = "Column1 asc"
but when i click the column name
the datagrid doesn't load anything, did i miss sth. on the sorting? thanks a
lot!!
in Sort_Command event handler
Dim SortView As DataView = DataSet11.Products.DefaultView
SortView.Sort = e.SortExpression
DataGrid1.DataSource = SortView
DataGrid1.DataBind()