由于http协议是无状态的,这个问题有点难度。我碰到类似问题时,即子窗口有数据操作和更新,并需要数据更新后弹出此子窗口的窗口能反映更新后数据的话,我一般不采用弹出新窗口来编辑数据,而是在原Page上加一个Panel,正常情况下是隐藏的,在编辑数据时才显示出来,并在编辑完并更新数据后再隐藏该panel,并刷新页面其它的数据显示。

解决方案 »

  1.   

    你不用 opener,又能用什么呢?
      

  2.   

    用opener就得用window.open
    window.open打开一个新的页面,感觉就象respons.redirect的效果不是我想要的,我想是弹出子窗口的效果或则有办法控制window.open 打开窗口的大小也可以
      

  3.   

    window.open是可以控制窗口大小的。Syntax
    oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace])ParameterssURL Optional. String that specifies the URL of the document to display. If no URL is specified, a new window with about:blank is displayed. 
    sName Optional. String that specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an a element._blank The sURL is loaded into a new, unnamed window. 
    _media   The sURL is loaded into the HTML content area of the Media Bar. Available in Internet Explorer 6 or later. 
    _parent The sURL is loaded into the current frame's parent. If the frame has no parent, this value acts as the value _self. 
    _search Available in Internet Explorer 5 and later. The sURL is opened in the browser's search pane. 
    _self The current document is replaced with the specified sURL . 
    _top sURL replaces any framesets that may be loaded. If there are no framesets defined, this value acts as the value _self. 
     
    sFeatures Optional. This String parameter is a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following features are supported.channelmode = { yes | no | 1 | 0 } Specifies whether to display the window in theater mode and show the channel band. The default is no. 
    directories = { yes | no | 1 | 0 } Specifies whether to add directory buttons. The default is yes. 
    fullscreen = { yes | no | 1 | 0 } Specifies whether to display the browser in full-screen mode. The default is no. Use full-screen mode carefully. Because this mode hides the browser's title bar and menus, you should always provide a button or other visual clue to help the user close the window. ALT+F4 closes the new window. A window in full-screen mode must also be in theater mode (channelmode).  
    height = number Specifies the height of the window, in pixels. The minimum value is 100. 
    left = number Specifies the left position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.  
    location = { yes | no | 1 | 0 } Specifies whether to display the input field for entering URLs directly into the browser. The default is yes. 
    menubar = { yes | no | 1 | 0 } Specifies whether to display the menu bar. The default is yes. 
    resizable = { yes | no | 1 | 0 } Specifies whether to display resize handles at the corners of the window. The default is yes. 
    scrollbars = { yes | no | 1 | 0 } Specifies whether to display horizontal and vertical scroll bars. The default is yes. 
    status = { yes | no | 1 | 0 } Specifies whether to add a status bar at the bottom of the window. The default is yes. 
    titlebar = { yes | no | 1 | 0 } Specifies whether to display a title bar for the window. This parameter is ignored unless the calling application is an HTML Application or a trusted dialog box. The default is yes. 
    toolbar = { yes | no | 1 | 0 } Specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available. The default is yes. 
    top = number Specifies the top position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.  
    width = number Sets the width of the window, in pixels. The minimum value is 100. 
     
    bReplace Optional. When the sURL is loaded into the same window, this Boolean parameter specifies whether the sURL creates a new entry or replaces the current entry in the window's history list. true sURL replaces the current document in the history list 
    false sURL creates a new entry in the history list.  
     
      

  4.   

    我觉得这个问题不难解决啊。
    window.showModalDialog的页面关闭以后会有一个window.returnValue的值传回来的,
    因为在调用window.showModalDialog一般都是这样设定的:
    var xxx = window.showModalDialog("xxx","xxx","xxx");
    那么可以在showModalDialog的页面的返回值中设置一个需要刷新的标记。
    在得到xxx的值以后,判断这个值中表示是否需要刷新的值是否为需要刷新,如果是,
    那么直接在后面的代码中调用window.location.refresh();或者window.location.href="";简单的代码如下:这里只是为了说明问题,代码并一定可行:var test = window.showModalDialog("http://localhost/test.jsp");
    // test.jsp的返回值中包含了一个boolean的变量needRefresh,表示是否需要刷新
    if (test.needRefresh)
    {
        window.location.refresh();
    }----在test.jsp中设置一个returnValue:aaa.needRefresh = true;
    //这里的aaa是一个自己定义的对象
    window.returnValue = aaa;
      

  5.   

    supertoto(超级马桶) (
    在服务器端判断返回值也不容易吧sqr5(五的平方)
    在MSDN上没找到你贴的这段东西,我试了那些参数,好象不起作用,能不能贴一段代码出来
      

  6.   

    Window.open() 全攻略:
    http://www.w12345.com/pc/12/page/javascripths.htm
      

  7.   

    window.open('GroupEditor.aspx','newwindow','100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no')这段东西也不好用????!!!在客户端调用的,还是满屏显示
      

  8.   

    sorry,不在。NET中预览是好用的但是为什么速度慢的惊人!!??
      

  9.   

    window.open('GroupEditor.aspx','newwindow','height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no');
      

  10.   

    window.open 和 window.showModalDialog的速度怎么差这么多
      

  11.   

    window.open的速度不能另人接受又发现刷新窗口自己就弹出子窗口的问题又陪上了一上午,有点灰心了,大家都是怎么处理数据修改的,提供点好方案我手里这个东西时间比较急
      

  12.   

    To xinxincao(辛欣草) 这个返回值是JS的返回值,不是服务器端的返回值,我想我已经看清楚了你的问题了。
    你要的是在dialog关闭以后刷新父窗口,这个刷新是通过js来完成了。你可以重新提交也可以用window.location.href="";用不着返回服务器端去操作的啊。window.returnValue是showModalDialog中关闭前返回给父窗口的值,可以是任何JS支持的数据类型,和服务器端没有关系。Good Luck!
      

  13.   

    supertoto(超级马桶) 已经说得很清楚了,再说就是白费口舌了!
      

  14.   

    try找开时把WINDOW做为参数传过去!
    这样打开页   window.showModalDialog("xxx",window.,"xxx"); 父页刷新按钮事件      window.dialogArguments.Form1.all('b_ref').click() 
      

  15.   

    在页面的<body>下面加 <base target="_self">
    Page.RegisterStartupScript("Open","<Script>window.showModalDialog(\"../call/cllSendUser.aspx\",'','dialogWidth: 640px,dialogHeight: 520px');" +
    "window.document.all.BtnUser.click();</Script>");
    BtnUser是页面中的按钮。就是在这一节中写一个刷新页面的脚本