Showing posts with label modalpopextender. Show all posts
Showing posts with label modalpopextender. Show all posts

Saturday, March 24, 2012

ModalPopExtender, Javascript & Master page

Hi

I googled about this problem and never found an answer. Everybody is complaining about it but nobody found any solution. I thought I will put the problem in this forum so some AJAX Guru can research and help us.

Here is the problem,

Whenever you use the ModalPopExtender and try to do something during begin of the postback or at the end of post back via javascript. It works fine in the single page. But as soon you add a master page, it doesn't work. It either says "null, null object not found" or object not found.. Whats the problem when its master page

<scripttype="text/javascript">

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);

function beginRequest(sender, args){

// show the popup

alert("here0");

var cmb = $find('mdlPopup');

//alert("here");

//find$('<%= mdlPopup.ClientID %>').show();

//var cmb = document.getElementByName('<%= mdlPopup.ClientID %>');

//var cmb = document.getElementByName(GetClientId("mdlPopup"));

if (cmb !=null) {

cmb.show();

alert("here2");

}

}

function endRequest(sender, args) {

// hide the popup

alert("here3");

$find('mdlPopup').hide();

}

</script>

<asp:UpdatePanelID="updatePanel2"runat="server">

<ContentTemplate>

<table>

<tr>

<td>

Signature:</td>

<td>

<asp:TextBoxID="signatureText"runat="server"/></td>

</tr>

<tr>

<td>

Bio:</td>

<td>

<asp:TextBoxID="bioText"runat="server"/></td>

</tr>

</table>

<asp:ButtonID="Button3"runat="Server"Text="Save"/>

<asp:LinkbuttonID="Button1"runat="Server"Text="Save"/>

<br/><br/>

Hit Save to cause a postback from an update panel inside the tab panel.<br/>

</div>

</ContentTemplate>

</asp:UpdatePanel>

<ajaxToolKit:ModalPopupExtender

ID="mdlPopup"runat="server"TargetControlID="pnlPopup"

PopupControlID="pnlPopup"BackgroundCssClass="modalBackground"/>

<asp:PanelID="pnlPopup"runat="server"CssClass="updateProgress"style="display:none">

<divalign="center"style="margin-top:13px;">

<imgsrc="../Images/simple.gif"/>

<spanclass="updateProgressMessage">Loading ...</span>

</div>

</asp:Panel>

It will really help if somebody finds a solution for it..

VIJAI

Hi,

Thank you for your post!

This works on my machine:

<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);
function beginRequest(sender, args){
alert("here0");
var cmb = $find('<%=mdlPopup.ClientID %>');
cmb.show();
alert("here2");
}
function endRequest(sender, args) {
alert("here3");
$find('<%=mdlPopup.ClientID %>').hide();
}

</script>

If yo have further questions,let me know!

Best Regards,

ModalPopExtender DynamicServiceMethod with Master Page

If I place this in a <asp:content> on master page:

<asp:linkbutton runat="server" id="testLB" text="test" />
<atk:ModalPopupExtender runat="server" ID="mpuNotes" TargetControlID="testLB" PopupControlID="panmpu"
BackgroundCssClass="modalBackground" DropShadow="true" OkControlID="mpubutOk"
DynamicControlID="panNote" DynamicServiceMethod="GetNote">
</atk:ModalPopupExtender>
<asp:panel runat="server" id="panmpu" cssclass="modalPopup">
Davs
<asp:Panel runat="server" ID="panNote" />
<asp:Button runat="server" ID="mpubutOk" Text="Close" />
</asp:panel>

And the codefile looks like this:

[System.Web.Services.WebMethod]
public static string GetNote()
{
return "Hello - CodeFile";
}

The method is NOT called, but when moving it on a normal webform, it works. How to get it to work in a master page?


Looks like the ScriptService method is missing:http://blogs.msdn.com/sburke/archive/2006/10/21/hint-components-that-use-web-services-with-asp-net-ajax-v1-0-beta.aspx