Is there any client-side event that will fire after the detail table is expanded or collapsed?
I'm trying to solve this problem: I have a CommandItemTemplate with a LinkButton which should only be enabled when the number of selected rows > 0. The JS works fine, when linked to ClientEvents-OnRow{Selected|Deselected}. The problem comes when the row expands, and the ItemCommand is fired in conjunction with the BindDetailTable. After this event, the LinkButton is never again seen.
I have tried ItemCommand code-behind to set the Style["visibility"] = "none" (or "inline", if SelectedItems.Count>0), and I have tried a plethora of the ClientEvents-On* but nothing seems to work.
Here is the JS function which works as long as the detail table is not expanded:
And here is the ItemCommand code-behind:
I think a pure JS solution would work, if I could hook up the JS function to the end of the expand or collapse event, client-side.
Thanks,
Tim
I'm trying to solve this problem: I have a CommandItemTemplate with a LinkButton which should only be enabled when the number of selected rows > 0. The JS works fine, when linked to ClientEvents-OnRow{Selected|Deselected}. The problem comes when the row expands, and the ItemCommand is fired in conjunction with the BindDetailTable. After this event, the LinkButton is never again seen.
I have tried ItemCommand code-behind to set the Style["visibility"] = "none" (or "inline", if SelectedItems.Count>0), and I have tried a plethora of the ClientEvents-On* but nothing seems to work.
Here is the JS function which works as long as the detail table is not expanded:
| function ConditionallyEnableClearButton(sender, eventArgs) { |
| var masterTableView = sender.get_masterTableView(); |
| var selectedItems = masterTableView.get_selectedItems(); |
| var visibility = selectedItems.length > 0 ? "inline" : "none"; |
| var button = document.getElementById('<%= AlertGrid.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl("ClearButton").ClientID %>'); |
| if (button) { |
| button.style.display = visibility; |
| } |
| } |
And here is the ItemCommand code-behind:
| LinkButton clearButton = |
| grid.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl(CLEAR_BUTTON) as LinkButton; |
| var oldValue = clearAlertsButton.Style["display"]; |
| clearAlertsButton.Style["display"] = grid.SelectedItems.Count > 0 ? "inline" : "none"; |
I think a pure JS solution would work, if I could hook up the JS function to the end of the expand or collapse event, client-side.
Thanks,
Tim