This is a migrated thread and some comments may be shown as answers.

javascript setting node causing stack overflow

2 Answers 75 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
MVeranis
Top achievements
Rank 1
MVeranis asked on 02 Jul 2010, 04:44 PM
i'm getting a stack overflow on node1.select below.
tvAddr is a radtreeview. the node1/find and select java at the bottom reiterates - causing a stack overflow...any ideas or work-arounds? thanks.  i'm using 2010.1.519.35 version.  thanks.

 

function isInvoiceAddrSelectedValid(s, e) {

 

       var invaddr;

 

 

       invaddr = window.document.getElementById(

"cbInvTo").value;

 

       if (isAddrComplete(invaddr)) 

              {

       e.IsValid =

true;

 

 

              }

 

 

       else {

 

              var tree = $find("<%= tvAddr.ClientID %>");

 

              var addrvalue = window.document.getElementById("txtAddrTypeID").value;

 

              debugger;

 

              if (addrvalue != '') {

 

                     var node1 = tree.findNodeByValue(addrvalue);

                     node1.select();

                     e.IsValid =

false;

 

 

              }

              e.IsValid =

false;

 

 

}

}

 

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jul 2010, 02:08 PM
Hi,

I guess you have attached the function 'isInvoiceAddrSelectedValid' to OnClientItemSelected event of RadTreeView, therefor  the event calls itself when invoking the select() method and thus you got 'stack overflow' exception.

In order to avoid the exception, you can put one custom flag (Boolean variable) in the handler and check for the value when the function calls next time.


Hope this suggestion helps,
Shinu.
0
MVeranis
Top achievements
Rank 1
answered on 06 Jul 2010, 01:58 PM
thanks for the info. i'm redoing the design as it's not correct. i'm not calling the js function onclientclick but from a custom validation - if i have bad info on the "node", and the user selects another node, i don't want them to move off of that node. there are other ways to accomplish what needs to be done. so i'm re-vamping it. thanks for the info.
Tags
TreeView
Asked by
MVeranis
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
MVeranis
Top achievements
Rank 1
Share this question
or