locked
Modal Popup on pageload RRS feed

  • Question

  • User1760015249 posted

    Hi,

    I have to show the ajax modalpopup on the pageload. In mycase once all controls on the page displayed then popup is displaying(i.e popup is loading slowly).

    Loading Ajax modalpopup source from server side on the page load event.

    Please help me. I need to show modalpopup before controls.

    Tuesday, September 6, 2016 6:55 PM

All replies

  • User283571144 posted

    Hi newuser5431,

    newuser5431

    I have to show the ajax modalpopup on the pageload. In mycase once all controls on the page displayed then popup is displaying(i.e popup is loading slowly).

    Loading Ajax modalpopup source from server side on the page load event.

    Please help me. I need to show modalpopup before controls.

    According to your description, I can’t clearly understand your requirement.

    Could you please explain more about showing modalpopup before controls?

    Why your popup is loading slowly?

    Do you mean when the page load, the modalpopup window is show but it is empty and loaded very slowly?

    So you need modalpopup window show completely then show other controls?

    Do you use ajaxToolkit’s ModalPopupExtender control in your codes?

    Besides, I suggest you could post some relevant codes and more details information.

    It will be more easily for us understand your requirement clearly and help you solve the issue.

    Best Regards,

    Brando

    Wednesday, September 7, 2016 6:29 AM
  • User1760015249 posted

    Hi Brando

    Thanks for your reply.

    Below is my code:

    Parent Aspx :

    <asp:content attributes>

    <ajax:modalpopup attributes.. >

    <iframe id="ifrm" runat="server">

    </iframe>

    </asp:content>

    Parent Code behind :

    Pageload{

    if (!ispostback){

    ifrm.visible = true;

    ifrm.src = "Popuppage.aspx";

    }

    //some conditions

    }

    In popup page codebehind i have db call.

    Actually when i am redirected to the parent page from other page, i have to show modalpopup in parent page load.

    but in my case when i redirected to parent page, the controls in the parent page are displaying and after 10 to 15 sec popup is displaying.

    User should able to see the parent page controls only after clicking on close button which is in popup page.

    Do you mean when the page load, the modalpopup window is show but it is empty and loaded very slowly?

    No, popup itself not displaying. Initially parent page controls are loading.after few seconds popup is loading.

    In parent page load i have some conditions which is taking some time to load.

    Wednesday, September 7, 2016 6:28 PM
  • User283571144 posted

    Hi newuser5431,

    Actually when i am redirected to the parent page from other page, i have to show modalpopup in parent page load.

    but in my case when i redirected to parent page, the controls in the parent page are displaying and after 10 to 15 sec popup is displaying.

    User should able to see the parent page controls only after clicking on close button which is in popup page.


    According to your description and codes, I had written a test demo on my computer, I find the modalpopup will be fired at same time when the page load.

    But its content will display later.

    I think this is correct.

    More details, you could refer to follow codes and image:

    Parent Page:

     <div>
            <asp:Button ID="btnShow" runat="server" Text="Show Modal Popup" />
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1"  runat="server" PopupControlID="Panel1" TargetControlID="btnShow"
        CancelControlID="btnClose" BackgroundCssClass="modalBackground">
            </ajaxToolkit:ModalPopupExtender>
            <asp:Panel ID="Panel1" runat="server" align="center" style = "display:none">
        This is an ASP.Net AJAX ModalPopupExtender Example<br />
                <iframe id="AAA" runat="server"></iframe>
        <asp:Button ID="btnClose" runat="server" Text="Close" />
    </asp:Panel>
        </div>
     protected void Page_Load(object sender, EventArgs e)
            {
                if (!this.IsPostBack)
                {
                    ModalPopupExtender1.Show();
                    AAA.Src = "TestPage.aspx";
                }
            }

    Test Page:

     <div>
        This Page will Sleep 6 second............
        </div>
      protected void Page_Load(object sender, EventArgs e)
            {
                System.Threading.Thread.Sleep(6000);
            }

    Image:

    If you want to show modalpopup window firstly in the page.

    I suggest you could firstly redirect to modalpopup window page.

    In this page only show the modalpopup window.

    Then in its close button event, redirect to the second page.

    Best Regards,

    Brando

    Tuesday, September 13, 2016 5:59 AM