Homework
My code for this solution included the following logic in the sort event handler:
If ViewState("SortedColumn") = SortExpression And _ ViewState("SortOrder") = "ASC" Then ViewState("SortOrder") = "DESC" Else ViewState("SortOrder") = "ASC" End If ViewState("SortedColumn") = SortExpression
and the following code in the FillAndBind() routine:
SqlDataAdapter1.SelectCommand.CommandText += " order by " + _ ViewState("SortedColumn") + " " + ViewState("SortOrder")
Finally, it set a default sort order (i.e., "ASC") in the page_load() function.
Personal Database Project
I accepted most anything reasonable here.
Back to the top