|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
REPOST: MSDN UNIVERSAL NG SUPPORT, WHERE ARE YOU?I have an asp:DataGrid control with EnableViewState=False. I am calling
DataBind on both the non-postback and the postback. I am persisting the state of the grid myself and restoring the state (selectedItem, editItem, sortCommand, etc.). Everything is working just fine EXCEPT the CancelCommand event is not firing. All the other events ARE firing. Any ideas? What does your CancelCommand handler code look like?
BTW, is the address s-mar@nospam.nospam registered with MSDN's support? Show quoteHide quote "Scott M." <s-mar@nospam.nospam> wrote in message news:OsCOf5UGFHA.1836@tk2msftngp13.phx.gbl... >I have an asp:DataGrid control with EnableViewState=False. I am calling > DataBind on both the non-postback and the postback. I am persisting the > state of the grid myself and restoring the state (selectedItem, editItem, > sortCommand, etc.). Everything is working just fine EXCEPT the > CancelCommand event is not firing. All the other events ARE firing. > > Any ideas? > Here is the CancelCommand:
Private Sub dg_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg.CancelCommand viewstate.Add("editItem", -1) dg.EditItemIndex = -1 RestoreState() End Sub Private Sub RestoreState() 'Call this method in each DataGrid event handler 'to restore the new grid back to its previous state If Not IsNothing(viewstate.Item("editItem")) Then 'dg.EditItemIndex = CType(viewstate.Item("editItem"), Integer) End If If Not IsNothing(viewstate.Item("currentPage")) Then dg.CurrentPageIndex = CType(viewstate.Item("currentPage"), Integer) End If If Not IsNothing(viewstate.Item("currentSelection")) Then dg.SelectedIndex = CType(viewstate.Item("currentSelection"), Integer) End If If Not IsNothing(viewstate.Item("currentSort")) Then Dim dv As New DataView(ds.Tables(0)) dv.Sort = CType(viewstate.Item("currentSort"), String) dg.DataSource = dv End If dg.DataBind() End Sub And yes, my email address is registered with MSDN. Show quoteHide quote "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@sympatico.ca> wrote in message news:uH4EeJeGFHA.2156@TK2MSFTNGP09.phx.gbl... > What does your CancelCommand handler code look like? > > BTW, is the address s-mar@nospam.nospam registered with MSDN's support? > > > "Scott M." <s-mar@nospam.nospam> wrote in message > news:OsCOf5UGFHA.1836@tk2msftngp13.phx.gbl... >>I have an asp:DataGrid control with EnableViewState=False. I am calling >> DataBind on both the non-postback and the postback. I am persisting the >> state of the grid myself and restoring the state (selectedItem, editItem, >> sortCommand, etc.). Everything is working just fine EXCEPT the >> CancelCommand event is not firing. All the other events ARE firing. >> >> Any ideas? >> >
DataGrid for Data Entry
Template column base on another column value Conditionally set dataGrid Rows backcolor getting the data for dynamically for Datagrid aspx, word question How to properly Format zip code in a datagrid Call windows apps from web apps How to add javascript onClick attribute to datagrid's edit template (update command)? dropdownlist in datagrid Custom Paging Question |
|||||||||||||||||||||||