Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bubberz
Constraint Violating Yak Guru
289 Posts |
Posted - 2008-12-04 : 15:09:17
|
My issue is I'm trying to have a datagrid (ASP.NET 1.1) to allow editing, along with sorting ASC/DESC via column headers.When I click "Edit", my SQL query ASC goes to DESC, and vice versa. This happens on Cancel, Paging, Delete, etc...I'm trying to limit the "swap" in the order by criterion only when a header (of Template columns) is clicked. ****************I have this in the HTML:OnSortCommand="SortDG" AllowSorting="True"***************Code behind to try to limit only to column headers, but not working:Private Sub DGActivities_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DGActivities.ItemCommandIf e.Item.ItemType = ListItemType.Header ThenIf ViewState("DGActGlobalAscDesc") = "" ThenViewState("DGActGlobalAscDesc") = "ASC"SwapDirection(ViewState("DGActGlobalAscDesc"))ElseSwapDirection(ViewState("DGActGlobalAscDesc"))End IfEnd IfEnd Sub Sub SwapDirection(ByVal viewStateKey As String)If ViewState(viewStateKey) = "ASC" ThenViewState(viewStateKey) = "DESC"ViewState("DGActFieldAscDesc") = "DESC"ElseViewState(viewStateKey) = "ASC"ViewState("DGActFieldAscDesc") = "ASC"End IfEnd Sub |
|
|
|
|