請參考如下代碼:
在頁面A<head></head>中加入代碼:
<script language="javascript">

function ProScrap()
{//關閉頁面B :result將得到window.returnValue=AProScrap的值
var result=window.showModalDialog("頁面B.aspx","","directories:no;status:no;toolbar:no;scroll:no;help:no;dialogWidth:280px;dialogheight:200px");
}頁面B中加入:
<script language="javascript">
function ISfileValue()
{
var AProScrap=document.getElementById('IPProScrap').value;
if(AProScrap!="" && AProScrap!=undefined)
{
 var value=AProScrap.substr(AProScrap.lastIndexOf("\\")+1);
 AProScrap="ChangWu\\ProScrap\\" + value;
 window.returnValue=AProScrap;
     }
}
</script>

解决方案 »

  1.   

    1 在主窗体上加上js 
    function doResult(str1,str2){ 
    document.getElementById("txtkeywords1").value = str1; 
    document.getElementById("txtkeywords2").value = str2; 

    2 加弹出窗口上加上js 
    <script language="javascript"> 
    function onselect(val) 

    top.opener.doResult(val); 
    top.window.close(); 

    </script> 3 在列表的绑定事件上加上这个 
    private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) 

    if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 

    ((LinkButton)e.Item.FindControl("btnSelect")).Attributes.Add("onclick", "javascript:onselect("+e.Item.Cells[1].Text.Trim()+","+e.Item.Cells[1].Text.Trim()+");"); } 上面是参考,要作适当修改 
    }
      

  2.   

    楼主举个例子:现在又两个页面WebForm5.aspx和WebForm6.aspx在WebForm5.aspx页面中有一个TextBox1
    在WebForm5.aspx页面的.cs 中
     protected void Page_Load(object sender, EventArgs e)
            {
                Response.Write("<script>window.open('WebForm6.aspx')</script>");
            }
    在WebForm6.aspx页面中有一个CheckBoxList和一个Button1
    在WebForm5.aspx页面的.cs 中
     protected 6oid Button1_Click(object sender, EventArgs e)
            {
                string checkBoxVlaues = string.Empty;
                for (int i = 0; i < CheckBoxList1.Items.Count; i++)
                {
                    if (this.CheckBoxList1.Items[i].Selected)
                    {
                        checkBoxVlaues += CheckBoxList1.Items[i].Value;
                    }
                }
                Response.Write("<script>window.opener.document.getElementById('TextBox1').value='"+checkBoxVlaues+"';window.close(); </script>");
            }
    这样的话就可以在WebForm5.aspx页面TextBox1上显示你选择的值了。
      

  3.   

    在主页上加个函数,接收returnValue的。
    在弹出页的页面关闭的时候,加个返回值
      

  4.   

     function relatepic() {//相关图片
    var top;
    var left;
    top=(window.screen.availHeight-407)/2;
    left=(window.screen.availWidth-583)/2;
    window.open("newpaper/picman.aspx?fileid=<%=fileid%>&pathid=<%=pathid%>&objectName=<%=objectName%>","相关图片",
     "height=407,width=583,left="+left+",top="+top+",status=no,toolbar=no,menubar=no,location=no,help=no,scrollbars=yes");
    }
      

  5.   

    给你一个例子,你可以看下,如果看明白了,你只要修改几个字母就可以直接用:
    父窗体的JS代码:
    function viewgroup(){
          //var roleslist = window.showModalDialog("ShowDialog.aspx","","dialogHeight:750px;dialogWidth:650px;center:yes;");
          var url="ShowDialog2.aspx";                                 //转向网页的地址;
      var name="";                           //网页名称,可为空;
      var iWidth=650;                          //弹出窗口的宽度;
      var iHeight=700;                        //弹出窗口的高度;
      var iTop = (window.screen.availHeight-30-iHeight)/2;       //获得窗口的垂直位置;
      var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;
      window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=Yes,resizeable=no,location=no,status=no');         
     }
    子窗体的代码:
    function winreturn(){
         //getCheckValue();
        var boxes = document.getElementsByName("TypeId");  
       var groupTypeId = new Array();  
       var groupTypeName= new Array();
       var j = 0;
       var tempvalue;
        for (var i = 0; i < boxes.length; i++)  
        {  
        if (boxes[i].checked)  
        {  
            tempvalue=  boxes[i].value;        
            groupTypeName[j] = tempvalue.split("|")[1];
            groupTypeId[j]= tempvalue.split("|")[0];   
            j++;
         }  
         tempvalue = "";
       }  
       window.opener.document.getElementById("ctl00_ContentPlaceHolder2_selectInfo_DropCity").value=groupTypeId.toString();
    window.opener.document.getElementById("ctl00_ContentPlaceHolder2_selectInfo_DropCustomerName").value=groupTypeName.toString();    window.close(); 
    }
      

  6.   

    还有高手能解决此问题吗,翻遍CSDN的帖子,都没有找到解决方案?郁闷的等待