Wednesday, March 28, 2012

Content of popup, this is a problem

It seems that content of modal popup is in same page. is there any way to load content of a poupup from a web form without iframe or dynamic user control.

Sorry for my bad inglish

If you don't want to use an iframe, you could try using ahttpWebRequest.


Hi Nima,

Based on my experience , I think the easiest way is putting an UpdatePanel inside the Popped up Panel. So when we want to show the ModalPopupExtender , we first force the UpdatePanel to be refresh and get data from the server then make the ModalPopupExtender be shown. Here is the sample.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <style> .modalBackground { background-color:Gray; filter:alpha(opacity=70); opacity:0.7; } .modalPopup { background-color:#FFD9D5; border-width:3px; border-style:solid; border-color:Gray; padding:3px; width:250px; } </style> </head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Button ID="Button2" runat="server" Text="Button" Enabled="false" style="display:none"/> <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Height="50px" Width="235px" style="display:none" DefaultButton="Button4"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate><%=DateTime.Now.ToString()%> </ContentTemplate> </asp:UpdatePanel> <asp:Button ID="Button1" runat="server" Text="Cancel" /> <asp:Button ID="Button4" runat="server" Text="Button" /> </asp:Panel> <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button2" PopupControlID="Panel1" CancelControlID="Button1" DropShadow="true" BackgroundCssClass="modalBackground"> </ajaxToolkit:ModalPopupExtender> <input id="Button3" type="button" value="Click Me" onclick="showModalPopup()"/> <script type="text/javascript" language="javascript"> function showModalPopup(){ __doPostBack('<%=UpdatePanel1.UniqueID%>',''); $find("<%= this.ModalPopupExtender1.ClientID%>").show(); } </script> </form></body></html>
Another way is using WebService. We can get different content by sending the different contextKey.
I hope this helps.
Best regards,
Jonathan

Hi

Content of popup is asp.net form. if I use httpWebRequest or webservice form not work


Thanks

No comments:

Post a Comment