Protected Sub Repeater1_ItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs)
        If e.CommandName = "UpImage" Then
            Dim strindex As String = e.CommandArgument.ToString()
           '在这里如何关闭本页,并把另一页的textbox的text设置为strindex
           '可以把值保存到session中,但是关闭本页时如何触发一个事件,让另一页的textbox赋值??
        End If
    End Sub我的目的是这样,因为要输入一个编号,打开另一个页面给别人选,选完后关闭那一个,并为本页的编号textbox赋值。
输入编号页是不能刷新的。

解决方案 »

  1.   

     string javascript = "<script>opener.Form1.textbox1.value=strindex 
    ;window.close();</script>";
            Page.RegisterStartupScript("", javascript);
      

  2.   

    string javascript = " <script>opener.Form1.textbox1.value="+strindex+" 
    ;window.close(); </script>"; 
            Page.RegisterStartupScript("", javascript);
      

  3.   

    a.htm页面: 
    ----------------------------------------------------------------------------------------------------------------------------<html>
    <head>
    <script>
      function displayinfo()
      {
        var retVal = window.showModalDialog('b.htm',window,'');
        if(retVal == "refresh")
     {
       document.getElementById("txtname").value="测试用的";
     }
      }
    </script>
    </head>
    <body>
    <input type="text" onclick="return displayinfo();" name="txtname" id="txtname" value="">
    </body>
    </html>--------------------------------------------------------------------------------------------------------------------------------b.htm页面: 
    --------------------------------------------------------------------------------------------------------------------------------<html>
    <head>
    <script>
      function hgfd()
      {
      if(confirm('你确定要关闭吗?'))
      {
      window.returnValue = "refresh";
            window.close();
      }
      }
    </script>
    </head>
    <body>
    <table><tr><td>
    <input type="button" value="close" onclick="hgfd();"></td></tr></table>
    </body>
    </html>
      

  4.   

    楼主这个问题已经多次看到了,请google一下,都有解决方法,
    不是很麻烦的,但要在这里要说的很透彻,麻烦!
      

  5.   

    1 不知道你的编号是用什么呈现,假设是用dropdownlist 可以在onchange事件中 window.opener.document.getElementById("父页面textboxID").value="选择的值";2 可以 在本页面弹出一个div来 让用户选择
      

  6.   

    zhong2006 form1可以用xx.aspx来代替吗
      

  7.   

    http://blog.csdn.net/antiking/archive/2006/06/07/777849.aspx
    我的博客里有,当时思归的解答.自己看看吧.代码不拷贝过来了。
      

  8.   


    完全可以实现:非常常见的例子:(辅助录入的时候)点击一个textbox1  弹出一个对话框,选择你要的人员或其他,选好后,把选择的人员,ID,之类的返回来。并显示的,textbox1上。
    我实现,是用的JS当前有textbox1的页面function aaa()
    {
    strReturn=window.showModalDialog("../AAAA.aspx",'','dialogHeight=580px; dialogWidth=900px; dialogTop=50;help=no;scroll=yes;status:no;center:yes');document.getElementById("Text2").value=strReturn;
    }AAAA.aspx页面:<script type="text/javascript">
        function returnCloce(a)
        {
           window.returnValue=a;
           window.close();
        }
        </script>