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

Adding set_behaviors one by one

1 Answer 71 Views
Window
This is a migrated thread and some comments may be shown as answers.
Nik
Top achievements
Rank 1
Nik asked on 21 Oct 2009, 03:13 PM
Is it possible to not set the window behaviors all in one statement? I have a series of hidden form values that dictate whether the window should have reload or close or move options, but it's creating a nested if() nightmare. Can I somehow do radWnd.set_behaviors = radWnd.set_behaviors + radWnd.set_behaviors(x)?

I've also tried creating a string and setting it that way, which resulted in the window having no behaviors at all.
var hidShowCloseButton = getElementId(_strCPId + 'hidShowCloseButton'); 
        var hidHideReloadBtn = getElementId(_strCPId + 'hidHideReloadBtn'); 
        var hidWindowBehaviorMove = getElementId(_strCPId + 'hidWindowBehaviorMove'); 
        var strBehaviors = ""
        var strTelerik = "Telerik.Web.UI.WindowBehaviors."
         
        strBehaviors = strTelerik + "None"
        if (hidShowCloseButton != null) { 
                strBehaviors += " + " + strTelerik + "Close"
        } 
        if (hidWindowBehaviorMove != null) { 
                if (hidWindowBehaviorMove.value == "true") { 
                    strBehaviors += " + " + strTelerik + "Move"
                } 
          } 
        if (hidHideReloadBtn != null) { 
              if (hidHideReloadBtn.value == "true") { 
                    strBehaviors += " + " + strTelerik + "Reload"
              } 
          } 
          radWnd.set_behaviors(strBehaviors); 

1 Answer, 1 is accepted

Sort by
0
Nik
Top achievements
Rank 1
answered on 21 Oct 2009, 06:06 PM
Got it working.
radWnd.set_behaviors(eval(strBehaviors)); 

Although I am curious if there are other ways to do it! :)

Also, is there a way to change the behaviors with it still open? ie: when redirecting to another page in the same rad window.
Tags
Window
Asked by
Nik
Top achievements
Rank 1
Answers by
Nik
Top achievements
Rank 1
Share this question
or