Adding set_behaviors one by one

2 posts, 0 answers
  1. Nik
    Nik avatar
    51 posts
    Member since:
    Sep 2009

    Posted 21 Oct 2009 Link to this post

    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); 

  2. Nik
    Nik avatar
    51 posts
    Member since:
    Sep 2009

    Posted 21 Oct 2009 Link to this post

    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.
Back to Top