Dynamic modalpopupextender的多个实例

时间:2009-08-21 17:32:35

标签: asp.net-ajax

我在用户控制中有modalpopupextender。我加载用户控件动态和该用户控件的多个实例意味着我有多个动态加载的modalpopupextender实例。如何设置behaviorid,以便我可以调用.add_shown方法在模态弹出窗口上调用一些javascript?

1 个答案:

答案 0 :(得分:1)

这应该可以解决问题:

function pageLoad(){

//Find all the Popups that deal with ZoomTo and add a add_shown handler.
var AllThem = Sys.Application.getComponents();

for (them in AllThem) {
    if (AllThem[them]._PopupControlID != undefined) {
        var d = AllThem[them]._PopupControlID;
        if (d.indexOf("ZoomToPanel") >= 0) {
            //Add the
            AllThem[them].add_shown(onZoomToPanelShown);
        }
    }
}
}


function onZoomToPanelShown() {
   //Clear the AutoComplete box.
   var t2 = $$get('txtAutoComplete');
   t2.value = "";
}