简体   繁体   English

在弹出窗口中打开一个新页面而不是DIV

[英]Open a NEW page in a pop up instead of a DIV

I have a DIV which opens after the submission of form on button click . 我有一个DIV ,在button click提交表单后打开。 the div code is below div代码如下

<div id="successmsg" style="font-family: 'signika_negativeregular', sans-serif; font-size: 0.9em;">

                            <div style="height: auto; margin-bottom: 10px; color: #193284; padding: 5px 5px 5px 5px; font-size: 15px; background: url(images/common/header-bottom-line.png) no-repeat bottom left; font-weight: bold; line-height: 1.5em;">
                                <div id="divTitle1" runat="server"></div>

                                <div style="width: 434px; margin-bottom: 10px; line-height: 1.7em; text-align: justify; font-size: 14px; font-family: 'signika_negativeRegular', sans-serif; color: #666; margin-top: 10px;">
                                    <div class="readmoreNew2">
                                        We appreciate and acknowledge your interest shown towards RBL Bank.<br />
                                        Our team would get back to you soon.
                                    </div>
                                </div>

                                <input type="button" id="btnOk" value="OK" class="btnDropbox" style="background: #CF060D; font-family: 'signika_negativesemibold', sans-serif; color: #ffffff; font-size: 15px; font-weight: 500; text-transform: uppercase; border: none; padding: 5px 11px 5px 9px; cursor: pointer;" />
                            </div>

                        </div>

It looks something like this . 它看起来像这样

The code to open this in pop up is given below in JS and code-behind of button click, 在弹出窗口中打开它的代码在下面的JS和按钮点击代码隐藏中给出,

JAVASCRIPT CODE JAVASCRIPT代码

 $(document).ready(function () {
            $("#successmsg").dialog({
                autoOpen: false,
                height: 230,
                width: 580,
                modal: true,
                open: function () {
                    $('#btnClose').click(function () {
                        $("#successmsg").dialog('close');
                    });
                },
                beforeClose: function (event, ui) {
                    location.href = "Career.aspx";
                }
            });
            $("#btnOk").on("click", function () {
                $("#successmsg").dialog('close');
            });
            $('.ui-dialog .ui-dialog-titlebar').css({ 'background': 'none', 'display': 'none' })
        });

Also see the codebehind of button click 另请参阅按钮单击的代码隐藏

CODE BEHIND 代码背后

protected void btnSubmit_Click(object sender, EventArgs e)
{
 ClientScript.RegisterStartupScript(this.GetType(), "uploaded", "$(document).ready(function(){$('#successmsg').dialog('open');});", true);
}

Now, Instead of div. 现在,而不是div。 I have a page called Thanks.aspx which I want to call in a pop up. 我有一个名为Thanks.aspx的页面,我想在弹出窗口中调用它。

Please help, how to do this. 请帮忙,怎么做。

First Method 第一种方法

Url string 网址字符串

var strURL="yourfilepath?string1="+string1+"&string4="+string4

Then use window.open() 然后使用window.open()

 var mywindow = window.open(strURL,'','width=690,height=1000,scrollbars=1,resizable=1,top=10,left=200');

Second method using jquery 第二种方法使用jquery

 $('#dialog').load('yourpath', function() { $(this).dialog({ modal: true, height: 200 }); });

third Method 第三种方法

protected void Button_Click(object sender, EventArgs e)
{
    string string1 = "pagename.aspx" ;
    string newWindow ="window.open('" + string1+ "');";
    ClientScript.RegisterStartupScript(this.GetType(), "pop", newWindow, true);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM