When user clicking "view" on the radContextMenu, btn.click(); repeats itself over and over again until it throws an Stack Overflow error. Can someone please point me a workaround? Thank you!!
| hours ago (permalink) |
| var check = true; |
| function OnToolBarButtonClicked(sender, args) { |
| var selectedRows = $find("<%= rg1.ClientID %>").get_masterTableView().get_selectedItems(); |
| if (selectedRows.length > 0) { |
| if (check) { |
| args.set_cancel(true); |
| } |
| btn = args.get_item(); |
| if (btn.get_commandName() == 'View' && check) { |
| btn.click(); |
| check = false; |
| } |
| } |
| } |
| function CallBackFn(args) { |
| if (args == true) { |
| btn.click(); |
| } |
| } |
| '============ Code Behind ====================================== |
| Public Sub OnMenuPostBackClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMenuEventArgs) |
| Case "View" |
| For Each item In rg1.MasterTableView.Items |
| If item.Selected = True Then |
| jobNm = item.GetDataKeyValue("JobName").ToString() |
| End If |
| Next |
| End Select |
| End Sub |
| '===================== ASPX ============================ |
| <telerik:RadToolBar ID="RadToolBar1" runat="server" style="display:block; float:none" Skin="Vista" OnClientButtonClicking="OnToolBarButtonClicked" OnButtonClick="ExecPostBackClick"> |
| <Items> |
| <telerik:RadToolBarButton runat="server" ImageUrl="style/images/window_view.gif" CommandName="View" ToolTip="View" /> |
| </Items> |
| </telerik:RadToolBar> |