JavaScript - Getting dynamically created control id in javascript

Asked By Harish Mady on 08-Mar-13 02:03 AM
Hi all,

i want the ability to have multiple different popup user controls on a page. so am adding behavior id on server side as

    popupcontrolid.behaviorid = "popu1" + ClientID;

now i want to hide it when user click at any position of the page. it worked on when i used only one popupcontrol with static behavior id.

  document.onclick = check;


  function check(e) {


  var popup = $find('popu1');

   popup.hidePopup();

   }

but when i add popupcontrolid.behaviorid = "popu1" + ClientID;
the function is not working out. please help me out


Erik Little replied to Harish Mady on 13-Apr-13 01:08 PM

You can always get the control like this. var myCtrl = document.getElementById('<%= myControl.ClientID %>') When you retrieve the control at this point it will be a standard DOM element, so I not sure if you can get to its wrapper. function check(e) {

 
var myCtrl = document.getElementById('<%= myControl.ClientID %>')


  var popup = $find('popu1');

   popup.hidePopup();

   }