Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Problem while sorting the datagrid

Hi guys,

I have a data grid and i want to sort by clicking on any of the columns. I am giving the code here.

Sub dgnotes_search(ByVal sender As Object, ByVal e As
DataGridSortCommandEventArgs)
Dim sortfield As String
sortfield = e.SortExpression
WhereSort = WhereSort & " order by " & sortfield
GridNoteLoad(WhereSort)

End Sub

I did declared the wheresort as String and i am getting the error at "WhereSort" that 'too many arguments to private sub GridNoteLoad()'
can you guys help me why i am getting this error..? appreciate your help.
Thanks
[656 byte] By [dev11] at [2007-11-11 7:20:27]
# 1 Re: Problem while sorting the datagrid
Are you binding the grid to a dataset having a table or are you using a dataview to bind
The following should do the job

DataView dv = dataset.DefaultView
dv.Sort = e.Sortexpression
Then bind the dataview to the grid and you should achieve the result
You are including the keywork orderby in the sort expression you shouldnt add that keyword If you dont want to do the above use just the e.sortexpression as the parameter to your GridNoteLoad, The thing is i do not know what you are doing in you GridNoteLoad method
srinivas_s at 2007-11-11 23:13:49 >