Is it possible to change the popupcontrolid of a modalpopup control using javascript (set the popupcontrol dynamically)?
We are trying implement a details view for a datagrid using modalpopup.The details of each row are rendered as hidden panels with different ID's. We have one modalpopup on the page and we would like to set the popupcontrolid of the modalpopup to different
detail panels depending on which row the user clicked. We would like to do everything on the client side without postbacks (partial or full)
We tried setting the the popupcontrolID on the modalpopup using the set_popControlID javascript function but it looks like that does not change the popupcontrolID associated to the modalpopup.
Can it by chance be a mistake? set_popControlID does not exist as property setter in the modal popup extender. Instead of this the setter is named
set_PopupControlID. The setter rises the PropertyChnaged event for the property named PopupControlID, so you should be able to track this down...
Furthermore, in order to set new popup control ID you need to hide and destroy the modal popup object, then set the new popup control ID and finally disply the modal popup again...
How about creating different modalpopup controls with a dummy button as the targetcontrolid and then using JS to show the correct one when you click the grid row?
There was a typo in my original message. it should have been set_PopupControlID instead of set_popControlID.
After looking at the javascript behind the modalpopup, I found that settting the popupcontrolID has no effect on what is being shown in the modalpopup.
After setting the popupcontrolID and OKcontrolID and CancelControlID, I called initialize and then show on the popup and then it worked. I am not sure if it is the right way to change popupcontrols dynamically using javascript but it works . The javascript
looks something like this
var modalPopupBehaviorCtrl = $find('detailPopup');
modalPopupBehaviorCtrl.set_PopupControlID(popupPanelID);
modalPopupBehaviorCtrl.set_OkControlID(OKControlID);
modalPopupBehaviorCtrl.set_CancelControlID(CancelControlID);
modalPopupBehaviorCtrl.initialize();
modalPopupBehaviorCtrl.show();
Thanks for the posts they were very helpful. It looks like when
initialize() is called that's when all the properties are set which control the element which acts as a modal window.
I am using ModalPopupExtender in my application. I need to change the
PopupControlID using Javascript. The following Javascript code is the one I am using to change the PopupControlID.
function showModalPopupViaClient(typeId,typeName,note)
{
var modalPopupBehavior = $find('programmaticModalPopupBehavior');
var id,dragid;
if(typeName ==
"Act")
{
id = '<%= pnlAct.ClientID %>';dragid =
'<%= pnlActDragHandle.ClientID %>';
etrast
Member
45 Points
14 Posts
changing popupcontrolid of modalpopup using javascript
Jul 25, 2007 08:08 PM|LINK
Is it possible to change the popupcontrolid of a modalpopup control using javascript (set the popupcontrol dynamically)?
We are trying implement a details view for a datagrid using modalpopup.The details of each row are rendered as hidden panels with different ID's. We have one modalpopup on the page and we would like to set the popupcontrolid of the modalpopup to different detail panels depending on which row the user clicked. We would like to do everything on the client side without postbacks (partial or full)
We tried setting the the popupcontrolID on the modalpopup using the set_popControlID javascript function but it looks like that does not change the popupcontrolID associated to the modalpopup.
Any replies will be greatly appreciated
TIA
sbogus
Member
353 Points
77 Posts
Re: changing popupcontrolid of modalpopup using javascript
Jul 26, 2007 01:03 PM|LINK
Hi,
Can it by chance be a mistake? set_popControlID does not exist as property setter in the modal popup extender. Instead of this the setter is named set_PopupControlID. The setter rises the PropertyChnaged event for the property named PopupControlID, so you should be able to track this down...
Furthermore, in order to set new popup control ID you need to hide and destroy the modal popup object, then set the new popup control ID and finally disply the modal popup again...
And it functions... :)
Kind regards,
sbogus.
Jason Hill
Contributor
2019 Points
497 Posts
Re: changing popupcontrolid of modalpopup using javascript
Jul 26, 2007 10:47 PM|LINK
How about creating different modalpopup controls with a dummy button as the targetcontrolid and then using JS to show the correct one when you click the grid row?
etrast
Member
45 Points
14 Posts
Re: changing popupcontrolid of modalpopup using javascript
Jul 27, 2007 02:18 PM|LINK
Thanks you very much for all the replies.
There was a typo in my original message. it should have been set_PopupControlID instead of set_popControlID.
After looking at the javascript behind the modalpopup, I found that settting the popupcontrolID has no effect on what is being shown in the modalpopup.
After setting the popupcontrolID and OKcontrolID and CancelControlID, I called initialize and then show on the popup and then it worked. I am not sure if it is the right way to change popupcontrols dynamically using javascript but it works . The javascript looks something like this
var modalPopupBehaviorCtrl = $find('detailPopup');
modalPopupBehaviorCtrl.set_PopupControlID(popupPanelID);
modalPopupBehaviorCtrl.set_OkControlID(OKControlID);
modalPopupBehaviorCtrl.set_CancelControlID(CancelControlID);
modalPopupBehaviorCtrl.initialize();
modalPopupBehaviorCtrl.show();
TIA
bobbins32
Member
16 Points
3 Posts
Re: changing popupcontrolid of modalpopup using javascript
Oct 16, 2007 11:16 PM|LINK
Thanks for the posts they were very helpful. It looks like when initialize() is called that's when all the properties are set which control the element which acts as a modal window.
UniqueRaj
Member
2 Points
7 Posts
Re: changing popupcontrolid of modalpopup using javascript
Aug 06, 2008 07:25 PM|LINK
Hi,
I am using ModalPopupExtender in my application. I need to change the PopupControlID using Javascript. The following Javascript code is the one I am using to change the PopupControlID.
function showModalPopupViaClient(typeId,typeName,note){
var modalPopupBehavior = $find('programmaticModalPopupBehavior'); var id,dragid; if(typeName == "Act"){
id = '<%= pnlAct.ClientID %>';dragid = '<%= pnlActDragHandle.ClientID %>';}
else if(typeName == "Mod"){
id =
'<%= pnl.ClientID %>'; dragid = '<%= pnlDragHandle.ClientID %>';}
else if(typeName == "PO"){
id = '<%= pnl1.ClientID %>';dragid = '<%= pnl1DragHandle.ClientID %>';}
else if(typeName == "Misc"){
id =
'<%= pnl2.ClientID %>'; dragid = '<%= pnl2DragHandle.ClientID %>';}
modalPopupBehavior.set_PopupControlID(id);
modalPopupBehavior.set_PopupDragHandleControlID(dragid);
modalPopupBehavior.initialize();
modalPopupBehavior.show();
}
Please let me know any changes need to be done.
Need Help Urgently.
Modal popup extender javascript master page mODAl popup extender and show/hide
Raj.
bobbins32
Member
16 Points
3 Posts
Re: changing popupcontrolid of modalpopup using javascript
Aug 07, 2008 05:44 PM|LINK
What error is your code giving you. It looks correct. I use the following method to change the PopupControlID :
function
showModalLayer(divId){
var modalPopupBehavior = $find('programmaticModalPopupBehavior'); //manually center the divmodalPopupBehavior._layout();
//set the popup control id property for the modal popup extendermodalPopupBehavior.set_PopupControlID(divId);
modalPopupBehavior.initialize();
//show gray backgroundmodalPopupBehavior.show();
}
maramkiranku...
Member
7 Points
3 Posts
Re: changing popupcontrolid of modalpopup using javascript
Jul 04, 2012 07:01 AM|LINK
For first click its showing popup, but from second click onwars its not showing can you please help me in this.... its urgent...........