all groups > asp.net datagrid control > october 2004 >
You're in the

asp.net datagrid control

group:

bidirectional sort with datagrid


RE: bidirectional sort with datagrid WebMatrix
10/25/2004 3:43:03 PM
asp.net datagrid control:
Very good example:
http://aspnet.4guysfromrolla.com/articles/012903-1.aspx

[quoted text, click to view]
Re: bidirectional sort with datagrid Steve C. Orr [MVP, MCSD]
10/25/2004 4:09:05 PM
Here's a good example for you:
http://www.dotnetjunkies.com/HowTo/B7C5AB3C-4D2E-4800-A071-6F40D57699C3.dcik

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


[quoted text, click to view]

bidirectional sort with datagrid DC Gringo
10/25/2004 6:05:11 PM
Can someone show me how to turn this into a bi-directional sort allowing
ascending and descending using the default datagrid allowsorting attribute?

FYI, Session("source") is an sqldataadapter
------------

Protected Sub SortCommand_OnClick(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
DataGrid2.SortCommand


Dim ds As DataSet = GetDataSource()
Dim dt As DataTable = ds.Tables(0)
dt.DefaultView.Sort = e.SortExpression

DataGrid2.DataSource = dt.DefaultView
DataGrid2.DataBind()

End Sub


Protected Function GetDataSource() As DataSet

Dim ds As New DataSet
Dim da As New SqlDataAdapter
da = Session("Source")
da.Fill(ds)
Return ds

End Function

Re: bidirectional sort with datagrid Saravana
10/26/2004 4:12:28 AM
Another example
http://www.dotnetbips.com/displayarticle.aspx?id=7

[quoted text, click to view]

Re: bidirectional sort with datagrid DC Gringo
10/26/2004 11:05:59 AM
Thank you...

The problem I have with this example is it makes me manually enter the
Select Cases for each column. I'm looking for something that will
dynamically update with changes in the datagrid columns?

' Figure out the column index
Dim iIndex As Integer
Select case ColumnToSort.toUpper()
case "AU_FNAME"
iIndex = 0
case "AU_LNAME"
iIndex = 1
case "STATE"
iIndex = 3
End Select

_____
DC G


[quoted text, click to view]

AddThis Social Bookmark Button