如何在asp.net页面中使用javascript创建弹出窗口 - 无法在javascript弹出窗口中传递值

时间:2021-08-08 15:25:11

In my parent window (list page) there are multiple rows which represents individual person. beside each persons name there is icon which hyperlinks to the "change status" page.

在我的父窗口(列表页面)中,有多行代表个人。在每个人名旁边都有一个超链接到“更改状态”页面的图标。

the requirement is when clicking on the icon a popup page will open where the status of that person can be edited.

要求是当点击图标时,将打开一个弹出页面,可以在其中编辑该人的状态。

I have created the popup but the problem is i cant pass the value in popup screen. so the popup page is not having value for that particular person.

我创建了弹出窗口,但问题是我无法在弹出屏幕中传递值。所以弹出页面没有该特定人的价值。

previously the change status page was not in popup. the following code was used to open the change status page from list page (which is now parent screen)

以前更改状态页面不在弹出窗口中。以下代码用于从列表页面(现在是父屏幕)打开更改状态页面

<a class="hover-glow"
                                        data-placement="bottom" rel="tooltip"
                                        title="change status"
                                        data-bind="attr: { 'href': 'update-status_popup.aspx?i=' + Id + '&c=' + StatusId }">
                                       <i class="icon icon-random"></i>
                                    </a> 

I have now replaced code by

我现在已经替换了代码

<a href="javascript:popUp('update-status_popup.aspx')" >
                                       <i class="icon icon-random"></i>

                             </a>

by this code i can open the change status page in a popup screen but i cant pass the value. to pass the value i have tried the following code

通过此代码,我可以在弹出屏幕中打开更改状态页面,但我无法传递该值。传递值我尝试了以下代码

 <a href="javascript:popUp('update-status_popup.aspx?i=' + Id + '&c=' + StatusId')" >
                                       <i class="icon icon-random"></i>

                             </a>

and

   <a href="javascript:popUp('update-status_popup.aspx?i='" + Id + "'&c='" + StatusId"')" >
                                       <i class="icon icon-random"></i>

                             </a>

If I apply any of the last two codes the popup screen doesn't open.

如果我应用最后两个代码中的任何一个,则弹出屏幕不会打开。

how can I make this work.

我怎样才能做到这一点。

The javascript code for creating the popup screen is like following

用于创建弹出屏幕的javascript代码如下所示

  function popUp(URL) {
        day = new Date();
        t = day.getTime();
        eval("page" + t + " = window.open(URL, '" + t + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 560,top = 240');");
    }

1 个解决方案

#1


1  

Instead of sending data like you shown,you can try session..

您可以尝试会话,而不是像您显示的那样发送数据。

 Session["i"] = id;
 Session["c"] = StatusId;

You can access this in your page load of the popup..

您可以在弹出窗口加载中访问它。

string a=Session["i"].tostring();
string b=Session["c"].tostring();

#1


1  

Instead of sending data like you shown,you can try session..

您可以尝试会话,而不是像您显示的那样发送数据。

 Session["i"] = id;
 Session["c"] = StatusId;

You can access this in your page load of the popup..

您可以在弹出窗口加载中访问它。

string a=Session["i"].tostring();
string b=Session["c"].tostring();