Showing posts with label IFrame. Show all posts
Showing posts with label IFrame. Show all posts

Monday, December 21, 2015

Display jquery dialog in parent window

The example below is a simple way to display a dialog in the parent window from an iframe.
  • Include jquery and jqueryui into your parent window
  • After this you can access to the parent JQuery object within iframe
   <script type="text/javascript">
         $(document).on("click", "[id*=btnShowPopup]", function () {
            var $jParent = window.parent.jQuery.noConflict();
            var dlg1 = $jParent('#editGiveawayDialog');
              dlg1.dialog({
               title: "Display Dialog",
               width: 550,
               height: 300,
               zIndex: 10000,
                 buttons: {
                   Ok: function () {
                     dlg1.dialog('close');
                   },
                   Cancel: function () {
                     dlg1.dialog('close');
                   }
                  },
                   modal: true
               });
               return false;
           });
            </script>

Hope this helps! :)

Wednesday, December 25, 2013

Using Htmlframe tag instead of Iframe tag

I recently was working on a project where I had to use an Iframe. This Iframe would get querystring parameters and pass it to the associated page in the Iframe. Now, if your using a standard .aspx page, you won't need this tip. This tip if for people that are using Iframes in their controls. Since controls use System.Web.UI.UserControl and not the standard System.Web.UI.Page that pages use. You won't be able to use the standard Iframe tag. Instead you'll need to use the server Iframe version. Before using this server tag, you'll need to add the snippet below to your web.config in the controls section. Then add the following snippet in your control. Hope this was helpful!  
 <controls>
      <add assembly="System.Web" namespace="System.Web.UI.HtmlControls"
tagprefix="asp"/>   </controls>

 <asp:HtmlIframe frameborder="0" height="650" id="myiframe" name="myiframe" runat="server" src="prefcontent.aspx" width="400">
</asp:HtmlIframe>