.click causes Stack overflow

2 posts, 0 answers
  1. Pei Chen
    Pei Chen avatar
    12 posts
    Member since:
    Jan 2010

    Posted 11 Jan 2010 Link to this post

    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) {     
                     btn = args.get_item();     
                     if (btn.get_commandName() == 'View' && check) {     
                            check = false;     
         function CallBackFn(args) {     
             if (args == true) {     
    '============ 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     
            End Select     
    End Sub     
    '=====================  ASPX ============================     
    <telerik:RadToolBar ID="RadToolBar1" runat="server" style="display:block; float:none" Skin="Vista" OnClientButtonClicking="OnToolBarButtonClicked"  OnButtonClick="ExecPostBackClick">      
                 <telerik:RadToolBarButton runat="server" ImageUrl="style/images/window_view.gif"  CommandName="View" ToolTip="View" />           
  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 12 Jan 2010 Link to this post

    Hi Pei Chen,

    Calling the btn.click() will fire again the OnClientButtonClicking event hence the problem.
    I suggest that you remove that line from your javascript code (OnToolBarButtonClicked method) since it is not needed.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
Back to Top