Sorting of datagrid column

G

Guest

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()
 
G

Guest

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top