I found one solution but for this I have to give a call to database every time I click on column for sort.
Private Sub GetProductList(ByVal sortColumn As String, ByVal sortDir As String)
'Deciding sort orders
Dim sortField As String = sortColumn
Dim sortOrder As String = sortDir
Dim sortOrderReverse As String = IIf(sortOrder = "ASC", "DESC", "ASC")
Dim cn As New SqlConnection(MyConnectionString)
Dim cm As New SqlCommand
cn.Open()
Try
With cm
.Connection = cn
.CommandType = CommandType.Text
Try
Dim sql1 As String = String.Format( _
"SELECT TOP 50 * FROM tabProduct ORDER BY {0} {1}", sortField, sortOrder)
Dim sql2 As String = String.Format( _
"SELECT TOP {0} * FROM ({1})as a ORDER BY {2} {3}", _
grdProductList.PageSize, sql1, sortField, sortOrderReverse)
Dim sql3 As String = String.Format( _
"SELECT * FROM ({0})as b ORDER BY {1} {2}", _
sql2, sortField, sortOrder)
.CommandText = sql3
Dim da As SqlDataAdapter = New SqlDataAdapter(sql3, cn)
Dim ds As New DataSet
da.Fill(ds, "tabProduct")
YUIGrid1.DataSource = ds
YUIGrid1.DataBind()
Catch ex As Exception
Finally
End Try
End With
Catch ex As Exception
End Try
upnlProductListGrid.Update()
End Sub
Protected Sub grdProductList_PageIndexChanged(ByVal sender As Object, ByVal e As ExtExtenders.PageIndexChangedArgs) Handles grdProductList.PageIndexChanged
GetProductList(e.sortColumn, e.sortDir)
End Sub