vs2003的代码都行,为什么在vs2008就行不通了。
 protected void DataGrid1_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        Response.Write("<script language=\"javascript\">");
        Response.Write("function returntext()");
        Response.Write("{"); //window.parent.docuent.getElementById("s").value = s;window.frames[0].document.getElementById("TextBox1").value        Response.Write("window.dialogArguments.document.getElementById('kmbh').value='" + e.Item.Cells[1].Text.ToString().Trim().ToString() + "';");        Response.Write("window.dialogArguments.document.getElementById('customer_id').value='" + DataGrid1.DataKeys[(int)e.Item.ItemIndex].ToString().Trim() + "';");
        Response.Write("window.close();");
        Response.Write("<script>self.close()</script>");
        Response.Write("}");
        Response.Write("</script>");
        string jsStr;
       // jsStr=Response.Output.ToString();
        jsStr = "<script language=JavaScript>returntext();</script>";
        //Page.ClientScript.RegisterStartupScript(this.GetType(), "", jsStr);
       // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), jsStr, jsStr);
        AlertMsg(jsStr);
        //this.Page.RegisterStartupScript("alert", jsStr);
    }
    protected void AlertMsg(string msg)
    {
        //    this.Page.RegisterStartupScript("alert", "<script language=\"javascript\">alert('" + msg + "');</script>");
       string st = msg ;
        ClientScriptManager cs = Page.ClientScript;
        cs.RegisterStartupScript(this.GetType(), "alert", st);
    }
以上是子页源代码
<base target="_self"/>
<link href="css/forum.css" type="text/css" rel="stylesheet"/>
<% Response.Expires = -1;%>
以上是子页表现层代码。通过DataGrid,删除触发,选定值传入父页。
父页表现源代码如下。
<script  language="javascript" type="text/javascript">     function voucherSelect(pkid) {         var ret;
        ret = window.showModalDialog("selectcustomer.aspx?id=" + pkid + "", window, "dialogHeight:500px;dialogWidth:690px;center:Yes;Help:No;Resizable:No;Status:Yes;Scroll:auto;Status:no;");
        if (ret > 0)
            return false;
    }
</script>
</head>
<body >
<form id="Form1" method="post" runat="server">
<table width="100%">
<tr>
<td><uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td>
<DIV>当前位置:<font color="#ff0000">首页</font></DIV>
</td>
</tr>
<tr>
<td style="HEIGHT: 21px"><font face="宋体">当前客户销售维护(当日)</font></td>
</tr>
<tr>
<td style="HEIGHT: 21px"><asp:textbox id="kmbh" runat="server" Width="136px"></asp:textbox><input class="greenbuttoncss" style="WIDTH: 39px; HEIGHT: 17px" onclick="voucherSelect('<%=pkid%>')"
type="button" value="查找"/>

解决方案 »

  1.   

    你还是直接说F12看输出什么异常了吧
    或者将你那个拼接后的js完整的贴出来
      

  2.   

    调试没有反应。正常是单击datagrid的删除控件,就把值写入父页的文本框中。vs2003我都是这样写的,这次升级vs2008后就不行了呢?
      

  3.   

     各位大大,就是aspx源码这里出错。能否提个醒
    Response.Write("<script  type ='text/javascript'");
            Response.Write("function returntext()");
            Response.Write("{");
         Response.Write("var parWin = window.dialogArguments");
         Response.Write("parWin.document.getElementById('kmbh').value='" + e.Item.Cells[1].Text.ToString().Trim().ToString() + "';");     Response.Write("parWin.document.getElementById('customer_id').value='" + DataGrid1.DataKeys[(int)e.Item.ItemIndex].ToString().Trim() + "';");
            Response.Write("window.close();");
            Response.Write("}");
            Response.Write("</script>");
            string jsStr;
            jsStr = "<script language=JavaScript>returntext();</script>";
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", jsStr);
      

  4.   

     客户瑞运行是正常的呀。
    <script type ="text/javascript">
                function getParValues() {
                    // 接收父窗口传过的 window对象.
                    var parWin = window.dialogArguments;
                    parWin.document.getElementById("kmbh").value = "ee";
                    parWin.document.getElementById("customer_id").value = "33";
                    window.close();
    //
                }
        </script>
      

  5.   

    建议将js函数写到aspx页面,动态只生成调用参数,便于管理
    vs2008里,你建立的项目的.NET版本和原来的一样吗
      

  6.   

    重新建立.net版本